We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Showing TimeSpan in dd,hh:mm:ss format on Y axis

I need to show time spent on a process on the Y axis. The time that I have to show on Y is in seconds. I need to reformat labels on Y to dd,hh:mm:ss format.

The sample data would be as follows:

X Y
2006-12-05 2286
2006-12-06 3550
2006-12-08 954
2006-12-11 917
2006-12-12 7031

How do I do this?
Thanks
Dmitry

2 Replies

DS Dmitry Scherbakov January 2, 2007 08:44 PM UTC

I got the answer to this one. I should use ChartFormatAxisLabel event.

How can I format the ToolTip though?

Thanks
Dmitry

>I need to show time spent on a process on the Y axis. The time that I have to show on Y is in seconds. I need to reformat labels on Y to dd,hh:mm:ss format.

The sample data would be as follows:

X Y
2006-12-05 2286
2006-12-06 3550
2006-12-08 954
2006-12-11 917
2006-12-12 7031

How do I do this?
Thanks
Dmitry


SB Suresh Babu Syncfusion Team January 3, 2007 01:14 AM UTC

Hi Dmitry,

We appreciate you for finding the solution by yourself.

Here are the steps to format the TimeSpan in ToolTip. Please take a look into these steps.

1) Initialize the chart with data as you found.

2) Use the 'GetValueByPoint' method to get date time value from double and then convert the time span inside Chart control's MouseMove event. For example have a look at the following code.

[C#]
ChartPoint chpt = chartControl1.ChartArea.GetValueByPoint(new Point(e.X, e.Y));
string dx = chpt.DateX.ToShortDateString();
DateTime[] d = chpt.GetYValuesAsDateTime();
string dy = d[0].ToString("d,hh:mm:ss");

Please have a look into the Time span sample attached.

Let me know if this helps.

Thanks for using Syncfusion products.

Regards,
Sureshbabu

Loader.
Live Chat Icon For mobile
Up arrow icon