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

Problem binding object to RadChart

2 Answers 82 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
matt
Top achievements
Rank 1
matt asked on 02 Dec 2010, 02:47 PM
I looked up your example below and i am having problem reproducing it exactly like you.
I am not sure what my problem is because it looks pretty similar to your example to me.

http://www.telerik.com/help/aspnet/chart/grouping-databound-items.html

I have a list of custom objects with 3 properties (Service, Name, Quantity)
The list i get is as follow

    Name: "décembre"
    Quantite: 3
    Service: "C.I. Centre administratif "

    Name: "décembre"
    Quantite: 1
    Service: "C.I. Centre-ville"

    Name: "novembre"
    Quantite: 1
    Service: "C.I. Temporaire"

Public Sub RefreshData()
    Dim i As List(Of Intervention) = AccesDonneesHelper.GetInterventionsDetails()
    RadChart1.ChartTitle.TextBlock.Text = "MY GRAPH"
    RadChart1.Series.Add(New ChartSeries())
    RadChart1.DataSource = AddFilter()
    RadChart1.DataGroupColumn = "Service"
    RadChart1.PlotArea.XAxis.DataLabelsColumn = "Name"
    RadChart1.DataBind()
End Sub
and the output (see attached) is not what expected. There should be at least one bar in november. What am i doing wrong?

2 Answers, 1 is accepted

Sort by
0
matt
Top achievements
Rank 1
answered on 02 Dec 2010, 04:23 PM
I understand my problem. It is because a value is needed for each grouping otherwise it will put the first value it in the first index of the chart.
I am not sure I like this behavior but I reckon you should at least add a comment in your example that explains this behavior.

0
Ves
Telerik team
answered on 07 Dec 2010, 08:37 AM
Hello Matt,

Thanks for the note. That's correct -- the chart puts the first item in each series at the first available position, unless XValue is specified. I have attached a small example, showing how you can achieve your goal.

Best regards,
Ves
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Chart (Obsolete)
Asked by
matt
Top achievements
Rank 1
Answers by
matt
Top achievements
Rank 1
Ves
Telerik team
Share this question
or