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
close icon

[SF.Chart] Issue with Chart.PointToValue on DateTimeAxis shifted of 2 days...



I'm starting to use SF.Chart. I was using traditional LineChart before.

It's basic chart  with a DateTimeAxis as PrimaryAxis and NumericalAxis as SecondaryAxis.

I want to display information on the current point  on Series.MouseMove event like below.

But the function Chart.PointToValue(..) return a wrong value. The date is shifted by 2 days..   How can I fix that..

I have attached a sample


Best regards,


Code snippet [C#]:

void SeriesMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
     var point = e.GetPosition(this.lineChart);
     double xValue = this.lineChart.PointToValue(this.lineChart.PrimaryAxis, point);
     var date = DateTime.FromOADate(xValue);


2 Replies

RB Rodolphe Billottet February 6, 2014 04:57 AM UTC



It seems that I solved the issue with the following transformation:

             var point = e.GetPosition(this.lineChart);

            point.X = point.X - (yAxis.ActualWidth + lineChart.Margin.Left);

            double xValue = this.lineChart.PointToValue(this.lineChart.PrimaryAxis, point);


Can you confirm ?


What the point to have a method 'Chart.PointToValue' if we need to do such transformation ??

You should update the online documentation which is wrong..






KV Karthikeyan V Syncfusion Team February 6, 2014 11:08 AM UTC

Hi Rodolphe,

Thank you for the update.

We have analysed your reported query. You can achieve your requirement with the help of below code snippet.
Code snippet [C#]:
private void SfChart_MouseMouse(object sender, MouseButtonEventArgs e)
SfChart SER = e.Source as SfChart;
Point pt = e.GetPosition(SER.Series[0]); // To get exact position by Chart instance as a replacement for by Series.
YPoint = (SER.PointToValue(SER.SecondaryAxis, pt));
XPoint = (SER.PointToValue(SER.PrimaryAxis, pt));
var date = DateTime.FromOADate(XPoint);
And the codes suggested by you is not appropriate solution for this requirement, since this solution may be fail in case of multiple axes with chart.

Query 2: Documentation issue.

Thank you for your feedback. We will modify the mentioned page in our documentation and we will update the modified details in our upcoming release.

Please let us know if you require further assistance on this.

Karthikeyan V.

Live Chat Icon For mobile
Up arrow icon