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

Bar Chart databinding with collection and showing count

1 Answer 45 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Les
Top achievements
Rank 1
Les asked on 29 Nov 2010, 11:08 PM
This has probably already been answered before but I haven't been able to find anything so far...

I have an object that has some basic properties (ints, strings, etc) and also has a generic list of another object that some basic properties.  I want to do a bar chart that takes a collection of the first object and shows the value of a property on the first object (like a 'name') as the x category or whatever and charts the count of the total numbers of objects in the collection within the first object.

To build a simple senario, say i have Folder and each Folder has many documents.  I want to chart a bunch of Folders showing each folder name the count of how many documents are within each folder name (1, 12, 6, etc.)

Simple but cannot figure out how to do it correctly with the grouping and aggregate examples provided.  Any past forum posts you can link me to or a quick example using the folder/document example?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Evgeni "Zammy" Petrov
Telerik team
answered on 02 Dec 2010, 02:40 PM
Hello Les,

I have an object that has some basic properties (ints, strings, etc) and also has a generic list of another object that some basic properties.  I want to do a bar chart that takes a collection of the first object and shows the value of a property on the first object (like a 'name') as the x category or whatever and charts the count of the total numbers of objects in the collection within the first object.

What I understand is that you want to use a different object in the beginning of the chart and then use a list of other objects to fill the rest. What I would suggest is to use only the similar objects to bind to the chart. 
You can manually give series a label like that :

seriesMapping.LegendLabel = "People with Money";


To build a simple senario, say i have Folder and each Folder has many documents.  I want to chart a bunch of Folders showing each folder name the count of how many documents are within each folder name (1, 12, 6, etc.)

This looks like a normal scenario. You have a Folder class that has string Name property and int DocumentsCount property. You map Name to XCategory and map DocumentsCount to YValue.

 

All the best,
Evgeni "Zammy" Petrov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Chart
Asked by
Les
Top achievements
Rank 1
Answers by
Evgeni "Zammy" Petrov
Telerik team
Share this question
or