Customize RadCartesian Chart Item Labels

2 posts, 0 answers
  1. Harinath
    Harinath avatar
    1 posts
    Member since:
    Jan 2015

    Posted 22 Apr 2015 Link to this post


     I would like to customize item labels displayed on top of each bar. For Example:- if datapoint is 10.25(with data type as double), then i should show it as 10.15(HH:mm), same in the case of 10.50 as 10.30 and 10.75 as 10.45. Basically it should display equivalent hh:mm value to a double value. 

    Please let me know feasible solution to achieve this...

  2. Anna
    Anna avatar
    114 posts

    Posted 23 Apr 2015 Link to this post

    Hello Harinath,

    The ChartSeriesLabelDefinition class exposes the property Format, which can be used to change the formatting of the label. In your case the code would probably look similar to this:

    <telerik:ChartSeriesLabelDefinition HorizontalAlignment="Center" VerticalAlignment="Top" Binding="Hour" Format="{}{}">

    Of course, this will only work If the type of the underlying value is DateTime, but if your data is supposed to represent a point in time, DateTime seems to be a better choice of type than double. If your scenario requires the hours to be kept as doubles, you could convert them to DateTime before passing them to the chart.

    I hope this solution is suitable for your scenario. Please, let us know if you have any concerns.


    See What's Next in App Development. Register for TelerikNEXT.

Back to Top