stacked bar chard, only show label that have values

2 posts, 1 answers
  1. Kristjan Einarsson
    Kristjan Einarsson avatar
    95 posts
    Member since:
    Jan 2010

    Posted 24 Jan 2012 Link to this post

    Hi I have a stacked bar chart, can I disable labels that have 0 values as seen on the attached picture.

  2. Answer
    Evgenia avatar
    1398 posts

    Posted 26 Jan 2012 Link to this post

    Hello Kristjan,

    In order to hide the labels of items with zero values, you can simply remove the DataPoints in the following manner :
    RadChart1.ItemDataBound += new EventHandler<ChartItemDataBoundEventArgs>(RadChart1_ItemDataBound);
    void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
               if (e.DataPoint.YValue == 0)

    Alternatively, you may refer to the MeteoChart example, which uses a LabelVisibilityConverter class. Perhaps reviewing it would be helpful for you. Simply navigate to the Meteo Chart demo and press the View Code button to find the LabelVisibilityConverter.cs file.

    Kind regards,
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
Back to Top