这个示例展示了如何有条件地隐藏图表的 系列标签。 要这样做,则应接管 ChartControl.CustomDrawSeriesPoint 事件,然后可以修改 CustomDrawSeriesPointEventArgs.LabelText 参量的值。
注意 |
|---|
对于 WebChartControl,应该接管 WebChartControl.CustomDrawSeriesPoint 事件来完成此任务。 |
| C# | 复制代码 |
|---|---|
using System; using System.Windows.Forms; using DevExpress.XtraCharts; // ... private void chart_CustomDrawSeriesPoint (object sender, CustomDrawSeriesPointEventArgs e) { // If the value is less than 1, hide the point's label. if(e.SeriesPoint[0] < 1) { e.LabelText = ""; } } | |
| Visual Basic | 复制代码 |
|---|---|
Imports System Imports System.Windows.Forms Imports DevExpress.XtraCharts ' ... Private Sub chart_CustomDrawSeriesPoint (ByVal sender As Object, _ ByVal e As CustomDrawSeriesPointEventArgs) ' If the value is less than 1, hide the point's label. If e.SeriesPoint(0) < 1 Then e.LabelText = "" End If End Sub | |

Show Me |
|---|
在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E452。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。 |
注意
Show Me 