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

yearly bar graph

1 Answer 37 Views
Chart
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 19 May 2011, 12:44 PM
Hi!

I'm trying to create a 2D bar graph that will show values for each year.
2001 - 10
2002 - 2
2003 - 24
However I don't get it to work like I want to. I manage to get the values out correctly, but instead it says 1, 2, 3, 4 under.

I was trying to accomplish this by doing the same way that the standard chart works like -
List<KeyValuePair<string, int>>();

but that didn't work out as I said.

What kind of data can I assign to the graph to display the information I want to?


I've also tried to do this:
DataSeries dataSeries = new DataSeries();
 
            foreach (var pair in retVal)
            {
                var dp = new DataPoint {XCategory = pair.Key, YValue = pair.Value, IsDateTime = true};
                dataSeries.Add(dp);
            }
            InvoiceData = dataSeries;

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 24 May 2011, 10:31 AM
Hi John,

Basically, this sort of information is carried by the series labels - the labels positioned above the bar series. However, you can also add this data to the x axis labels. Essentially, you can have a field in the underlying datasource, which carries this information, and bind it accordingly. Which visual item in the chart is bound to this datafield is determined by the item mappings. More information on this is available in the following article:

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

Essentially, you can use the .XCategory or .Label mappings to visualize the data properly. 
Alternatively, depending on the precise setup, you may want to consider using grouping and/or aggregation. More informaiton on this is available in the following example:

http://demos.telerik.com/silverlight/#Chart/Aggregates

I hope this information helps.  

Regards,
Yavor
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
John
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or