Simple Pie Chart...

3 posts, 0 answers
  1. Neil Alderson
    Neil Alderson avatar
    4 posts
    Member since:
    Jan 2010

    Posted 18 Jan 2010 Link to this post

    Dear Telerik,

    For some reason I am struggling to create a very simple Pie Chart with your control (mainly due to lacking documentation I feel).

    I have the following data structure:



    class GraphDataView




        public decimal Consumption { get; set; }



        public DateTime DateTime { get; set; }



        public string DataType { get; set; }



    Now I'd like to construct a Pie Chart that displays the sum of the Consumption value for each DataType. This should be pretty straightforward to chart but I keep getting an NullReference exception. I am setting up the Pie Chart like this:




    summaryMapping = new SeriesMapping();


    summaryMapping.SeriesDefinition =

    new PieSeriesDefinition();







    new ItemMapping("Consumption", DataPointMember.YValue, ChartAggregateFunction.Sum));



    new ItemMapping("DataType", DataPointMember.Label));






    <GraphDataView> allConsumptionReadings = new List<GraphDataView>();




    summaryChart.ItemsSource = allConsumptionReadings;


    When I go to set the ItemsSource to a List of my data objects I get the following exception:
    {System.NullReferenceException: Object reference not set to an instance of an object.
       at Telerik.Windows.Data.ObjectDataBinder.GetValue(Object bindingSource, String propertyPath)}

    The "allConsumptionReadings" collection is filled with 23 GraphDataView objects, so this isn't the problem.

    Any ideas?

  2. Velin
    Velin avatar
    391 posts

    Posted 20 Jan 2010 Link to this post

    Hello Neil Alderson,

    Unfortunately, data grouping and aggregation is still not supported for the Pie series type. You will need to manually aggregate your data prior to data binding. Our developers will consider implementing this functionality in a future version of the control.

    Please accept our apologies for this inconvenience.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Neil Alderson
    Neil Alderson avatar
    4 posts
    Member since:
    Jan 2010

    Posted 21 Jan 2010 Link to this post

    Ok no problem. I solved this by aggregating the sumation into new business objects and used these for the Pie chart.

Back to Top