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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

115766 Feb 4,2014 11:58 PM Feb 6,2014 06:08 AM WPF 2
loading
Tags: Chart
Rodolphe Billottet
Asked On February 4, 2014 11:58 PM

Hi,

 

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,

Rodolphe

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);



LineChar_28a71746.zip

Rodolphe Billottet
Replied On February 5, 2014 11:57 PM

Hi,

 

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

http://help.syncfusion.com/ug/wpf/sfchart/default.htm#!documents/transformdatatopoint.htm

 

Regards,

Rodolphe

 


Karthikeyan V [Syncfusion]
Replied On February 6, 2014 06:08 AM

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.

Thanks,
Karthikeyan V.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;