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.

PointToValue on SfChart

Thread ID:

Created:

Updated:

Platform:

Replies:

117117 Aug 15,2014 01:42 PM Aug 26,2014 07:45 AM WPF 3
loading
Tags: SfChart
Kevin Kuebler
Asked On August 15, 2014 01:42 PM

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

Sumathi Jayaraj [Syncfusion]
Replied On August 19, 2014 01:12 AM

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

Kevin Kuebler
Replied On August 25, 2014 12:00 PM

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

Sumathi Jayaraj [Syncfusion]
Replied On August 26, 2014 07:45 AM

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

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.

;