Need help with simple pie chart

4 posts, 0 answers
  1. Novella
    Novella avatar
    4 posts
    Member since:
    Jul 2012

    Posted 19 Feb 2011 Link to this post

    I need to bind to a simple pie chart and I don't seem to be having any luck, perhaps there is something I'm missing.
    Basically, I have a collection of items with a property called "Status", which is a string. I want to create a pie chart that shows how many items have each "Status".  Here is what I've come up with, which just shows a solid blue circle.

    <telerik:RadChart  ItemsSource="{Binding}">
        <telerik:RadChart.DefaultSeriesDefinition>
            <telerik:PieSeriesDefinition/>
        </telerik:RadChart.DefaultSeriesDefinition>
        <telerik:RadChart.SeriesMappings>
            <telerik:SeriesMapping>
                <telerik:ItemMapping DataPointMember="XCategory" FieldName="Status" />
                <telerik:ItemMapping DataPointMember="YValue" FieldName="Status" AggregateFunction="Count" />
            </telerik:SeriesMapping>
        </telerik:RadChart.SeriesMappings>
    </telerik:RadChart>
  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 23 Feb 2011 Link to this post

    Hello Novella,

    When binding the control to a custom object, you will need to properly set the mappings. Additional information on this is available in the following topic:

    http://www.telerik.com/help/silverlight/radchart-populating-with-data-data-binding-with-manual-series-mapping.html

    When binding to a colleciton, you can take a slightly different approach, as shown in the following article:

    http://www.telerik.com/help/silverlight/radchart-populating-with-data-data-binding-to-nested-collections.html

    Also, you will need to ensure, that the field which you use for the y value has a numeric value, which can be used by the control to show.
    I hope this information helps.

    Regards,
    Yavor
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Alexander
    Alexander avatar
    21 posts
    Member since:
    Jun 2011

    Posted 18 Oct 2011 Link to this post

    I've got the similar problem... :(
  4. Alexander
    Alexander avatar
    21 posts
    Member since:
    Jun 2011

    Posted 18 Oct 2011 Link to this post

    Sorry. Fixed with changing mapping.GroupingSettings.ShouldFlattenSeries to true.
Back to Top