Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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