yearly bar graph

2 posts, 0 answers
  1. John
    John avatar
    24 posts
    Member since:
    Mar 2011

    Posted 19 May 2011 Link to this post


    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};
                InvoiceData = dataSeries;
  2. Yavor
    Yavor avatar
    11 posts

    Posted 24 May 2011 Link to this post

    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:

    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:

    I hope this information helps.  

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