Managing Chart Items

2 posts, 0 answers
  1. Chris Thierry
    Chris Thierry avatar
    138 posts
    Member since:
    Jun 2010

    Posted 04 May 2011 Link to this post


        Is there any way of managing items in a PieChart? for example I want to show in my chart products and percentages. Is the percentage is less than 10%, I will create an item "Other". Every product under 10% it will be in this item "Other". I can say 20 or 30 percent...I want also to define this value. In this way I can show always the same qty of items and add the "Other" item according to this logic.

    Can I do this using Chart Telerik RadControl?
    Thank you.

  2. Tsvetie
    Tsvetie avatar
    1517 posts

    Posted 10 May 2011 Link to this post

    Hello Chris Thierry,
    RadChart for Silverlight does not support this feature out of the box. You can, however, achieve the described result using one the the following approaches:
    • Construct your data source in such a way, so that all items with value less than 10% are added to an "Other" item.
    • Use the DataBound event of the chart to remove all items with YValue less than 10% and add them to a new "Other" item. For example:
      void RadChart1_DataBound(object sender, ChartDataBoundEventArgs e)
          DataSeries series = RadChart1.DefaultView.ChartArea.DataSeries[0];
          double sum = 0d;
          foreach (DataPoint point in series)
              sum += point.YValue;
          DataPoint[] seriesItems = new DataPoint[series.Count];
          ((Collection<DataPoint>)series).CopyTo(seriesItems, 0);
          double otherDataPointValue = 0d;
          for (var i = 0; i < seriesItems.Length; i++)
              DataPoint dataPoint = seriesItems[i];
              if (dataPoint.YValue / sum < 0.1d)
                  otherDataPointValue += dataPoint.YValue;
          DataPoint otherDataPoint = new DataPoint();
          otherDataPoint.YValue = otherDataPointValue;
          otherDataPoint.LegendLabel = "Other";

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top