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

Customize RadCartesian Chart Item Labels

1 Answer 92 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Harinath
Top achievements
Rank 1
Harinath asked on 22 Apr 2015, 10:24 AM

Hi,   

 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...

1 Answer, 1 is accepted

Sort by
0
Anna
Telerik team
answered on 23 Apr 2015, 12:50 PM
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="{}{0:hh.mm}">


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.

Regards,
Anna
Telerik
 

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

 
Tags
Chart
Asked by
Harinath
Top achievements
Rank 1
Answers by
Anna
Telerik team
Share this question
or