Bar Chart databinding with collection and showing count

2 posts, 0 answers
  1. Les
    Les avatar
    1 posts
    Member since:
    Oct 2010

    Posted 29 Nov 2010 Link to this post

    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.
  2. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 02 Dec 2010 Link to this post

    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
Back to Top