This is a migrated thread and some comments may be shown as answers.

Need help with simple pie chart

3 Answers 90 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Novella
Top achievements
Rank 1
Novella asked on 19 Feb 2011, 08:43 PM
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>

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 23 Feb 2011, 09:55 AM
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!
0
Alexander
Top achievements
Rank 1
answered on 18 Oct 2011, 02:20 PM
I've got the similar problem... :(
0
Alexander
Top achievements
Rank 1
answered on 18 Oct 2011, 03:34 PM
Sorry. Fixed with changing mapping.GroupingSettings.ShouldFlattenSeries to true.
Tags
Chart
Asked by
Novella
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Alexander
Top achievements
Rank 1
Share this question
or