DataPoint Label

2 posts, 0 answers
  1. Ed
    Ed avatar
    6 posts
    Member since:
    Feb 2010

    Posted 14 Jun 2010 Link to this post

    Hello-

    Is it possible to set the axis labels to use some custom string instead of the default XValue and YValue properties of the DataPoint? 

    I am constructing a list of DataPoint and binding that to the chart's ItemSource. I tried iterating through the TickPoint collection and setting the TickPoint.Label property, but the axis still shows the xvalues and yvalues. 

    thanks, 
    Edmund
  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 17 Jun 2010 Link to this post

    Hello Ed,

    For AxisX this is available out of the box. It is called "Categorical Chart", you can find more details in this help topic. This is also shown in this online example. Although it is focused on sorting and filtering, in this case you only need to pay attention on the XCategory mapping:

    gdpSeriesMapping.ItemMappings.Add(new ItemMapping("Country", DataPointMember.XCategory));

    For AxisY this is not available out of the box as the AxisY measures the data (the bar height, how high a line can go etc.) However you can wire the DataBound event of the chart and set AxisY.AutoRange to false. Then call AddRange(min, max, step) method to populate the axis as per your requirements and loop through the TickPoints collection and modify their labels. Note, that RadChart will put the default label if the value is empty string, so in order to show an empty tick label, set it to " " (with a single space).


    Best regards,
    Ves
    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