Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
Current coordinate point position from mouse cursor
posted

Hello,

I am in need of  help trying to get the tooltip data from the mouse cursor when the tooltip is not enabled. I noticed that when the tooltip is enabled, the tooltip is set to an object called "ScatterSeriesValueDataContext" which has the X, Y and colorscale properties. But when the tooltip is disabled, the tooltip object is null so I cannot access "ScatterSeriesValueDataContext" anymore.

Is it possible to get the X, Y and colorscale coordinates from the mouse cursor when the tooltip is not enabled? The image below references the data I am trying to get to in code behind. I am trying to get this working with XamDataChart using ScatterAreaSeries

Thank you,

Gabriel

Parents
No Data
Reply
  • 34810
    Verified Answer
    Offline posted

    Hello Gabriel,

    I have been investigating into the behavior you are looking to achieve in this case, and my best recommendation to you would be to use the UnscaleValue methods on the NumericX and NumericY axis against the current mouse position. For example, you could track this using the MouseMove event on the XamDataChart and then get the mouse position relative to the chart. This would return a Point, which you would then pass Point.X to the NumericXAxis.UnscaleValue and Point.Y to NumericYAxis.UnscaleValue. This would return you the X / Y coordinates as they pertain to the plot area of the chart.

    Regarding the color value, you would need to get this from the closest data item to the X / Y coordinates that you get from the UnscaleValue method calls mentioned above. I would again recommend using the mouse position relative to the chart, but this time with the ScatterAreaSeries.GetItem method. This will net you the closest data item to the mouse position, and you can use whichever value you are pointing the ColorMemberPath at, as that is what the value would be. Alternatively, if you know what the formula is to get the color member path in your data item, you could also run the unscaled values retrieved above to get a more accurate “Z” value where your function(X, Y) = Z.

    Please let me know if you have any other questions or concerns on this matter.

Children