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

Telerik RadHtmlChart Y Axis labels as seconds but showing time

1 Answer 121 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 09 May 2016, 08:57 PM

I have a line graph
The Y axis are time in seconds.

 

What I want is the legend for each point to be time not seconds

 

lineSeries1.TooltipsAppearance.DataFormatString = "{0}";

its just coming up with numbers though :(
also is there any way of formatting the Y axis, so that instead of seconds I get
5:00 10:00 15:00 20:00 25:00
etc ? which relates to
500 seconds 1000 seconds 1500 seconds 2000 seconds
etc
The data is fed in using a datatable in code behind so dont really want to hard code the times as they could be very variable.
foreach (DataRow row in dt.Rows){CategorySeriesItem item1 = new CategorySeriesItem(); item1.Y = int.Parse(row["TimeInSeconds"].ToString()); lineSeries1.SeriesItems.Add(item1);}
This draws the point, but what I want to be able to do is set the legends and labels for the time

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 12 May 2016, 10:39 AM

Hello Andrew,

You can use the Y-axis labels template feature that is available as of R2 2016. With it, you can create a function that will turn the seconds into the desired string. If you are using an older version, see this item that provides a workaround: http://feedback.telerik.com/Project/108/Feedback/Details/118025-add-templates-for-the-y-axis-in-radhtmlchart.

Regards,

Marin Bratanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Chart (HTML5)
Asked by
Andrew
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or