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

PointToValue on SfChart

I'm trying to use the PointToValue method of the SfChart control to create my own custom behavior (similar to the CrossHair behavior, but different enough that I couldn't use the built-in CrossHairBehavior). There seems to be something wrong with this method - the point that gets returned doesn't seem to quite match up with where the cursor is over the chart. It's off a little bit in the Y direction, and a little more in the X direction.

I've attached a sample to demonstrate. Run this sample app in Debug mode and watch the debug output as it reports the current position using the MouseMove event. If you place the mouse pointer right at the intersection of a couple of the grid lines, you'll see that the reported X and Y positions are off a bit. The Y value appears to be reported too low, just a little bit. But the X value is reported too high, a little more significantly off than the Y.

Any idea why this is, or know of a workaround to fix it? Also, the documentation on the PointToValue feature is a little confusing: http://help.syncfusion.com/ug/wpf/documents/transformdatatopoint.htm. The sample in that article refers to a "PointerMoved" event on the chart (as opposed to MouseMove), but I don't see that event available on the SfChart control. Am I just not seeing it for some reason, or is that a mistake in the docs?

Thanks,
Kevin Kuebler

Attachment: SfChartPointToValue_ba756832.zip

3 Replies

SJ Sumathi Jayaraj Syncfusion Team August 19, 2014 05:12 AM UTC

Hi Kevin,

We have analyzed your query and you can get X and Y value of the chart as shown in the below code snippet.

Code snippet[c#]:

var mousePoint = new Point

            {

                X = e.GetPosition(SampleChart).X - SampleChart.SeriesClipRect.Left,

                Y = e.GetPosition(SampleChart).Y - SampleChart.SeriesClipRect.Top

            };

We have modified your sample based on the requirements and the sample can downloaded from the following location. 

Query 2:

"PointerMoved" is an event for WinRT (it same as MouseMove in WPF). We have ported the WinRT code for all platforms. So we have added winrt code for this documentation. We will modify the documentation in our upcoming release.

Please let us know if you have any queries.

Regards,

Sumathi J


Attachment: SfChart_PointToValue_ad627c43.zip


KK Kevin Kuebler August 25, 2014 04:00 PM UTC

Hi Sumathi,

Ah, that works much better. Thanks! Getting much closer now to being able to move from the older chart control to the SfChart control. I will post if I run into any further issues, but it's looking pretty good now.

Thanks,
Kevin


SJ Sumathi Jayaraj Syncfusion Team August 26, 2014 11:45 AM UTC

Hi Kevin,

Thanks for update. Please let us know whether you require further assistance. As always we will be happy to assist you.

Regards,
Sumathi J

Loader.
Live Chat Icon For mobile
Up arrow icon