Hiding datapoint with zero values in stack bar

2 posts, 0 answers
  1. Gautam
    Gautam avatar
    4 posts
    Member since:
    Sep 2010

    Posted 23 Dec 2010 Link to this post

    I have requirement where I need to show stack bar chart with more than one legend and each legend having multiple datapoints. When I have a datapoint with value 0, it is also displayed in the stack bar label. Is it possible to hide the specific label in the bar?

    Please help!
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 23 Dec 2010 Link to this post

    Hello Gautam,

    You can set the StackedBarSeriesDefinition.LabelSettings.ShowZeroValueLabels to false:

    DataSeries series = new DataSeries();
    var definition = new StackedBarSeriesDefinition();
    definition.LabelSettings.ShowZeroValueLabels = false;
    series.Definition = definition;
     
    series.Add(new DataPoint(10));
    series.Add(new DataPoint(0));
    series.Add(new DataPoint(20));
     
    DataSeries series2 = new DataSeries();
    var definition2 = new StackedBarSeriesDefinition();
    definition2.LabelSettings.ShowZeroValueLabels = false;
    series2.Definition = definition2;
    series2.Add(new DataPoint(10));
    series2.Add(new DataPoint(50));
    series2.Add(new DataPoint(20));
     
    RadChart1.DefaultView.ChartArea.DataSeries.Add(series);
    RadChart1.DefaultView.ChartArea.DataSeries.Add(series2);

    Hope this helps.


    Best wishes,
    Freddie
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top