Skip to main content

How to: Conditionally Hide Series Labels

Handle the ChartControl.CustomDrawSeriesPoint event to conditionally hide series labels. In the event handler, change the CustomDrawSeriesPointEventArgs.LabelText property value to String.Empty to hide a label.

Note

Handling the WebChartControl.CustomDrawSeriesPoint (ChartControlSettings.CustomDrawSeriesPoint) event is necessary to perform the same for the Chart Control for ASP.NET and MVC.

private void OnCustomDrawSeriesPoint(object sender, CustomDrawSeriesPointEventArgs e) {
    if (e.SeriesPoint.Values[0] < 1) {
        e.LabelText = String.Empty;
    }
}

The following image demonstrates the result:

SeriesLabels_ConditionallyHide

See Also