Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > stacked bar chard, only show label that have values

Answered stacked bar chard, only show label that have values

Feed from this thread
  • Kristjan Einarsson avatar

    Posted on Jan 24, 2012 (permalink)

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

    Thanks
    sushibite
    Attached files

    Reply

  • Answer Evgenia Evgenia admin's avatar

    Posted on Jan 26, 2012 (permalink)

    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)
                   e.DataPoint.DataSeries.Remove(e.DataPoint);
           }

    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,
    Evgenia
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > stacked bar chard, only show label that have values
Related resources for "stacked bar chard, only show label that have values"

WPF Chart Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]