SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0
0

I am not able to find the data point corresponding to current mouse position on heatmap series PreviewMouseMove event.

Here is my code,

private void Contour_PreviewMouseMove(object sender, MouseEventArgs e)
    {
        var xCalc = Contour.RenderableSeries[0].XAxis.GetCurrentCoordinateCalculator();
        var yCalc = Contour.RenderableSeries[0].YAxis.GetCurrentCoordinateCalculator();
        Point mousePoint = e.GetPosition(((SciChartSurface)sender).ModifierSurface as UIElement);
        double peakXCordInfoValue = xCalc.GetDataValue(mousePoint.X);
        double peakYCordInfoValue = yCalc.GetDataValue(mousePoint.Y);
    }

“Contour” is my SciChart object. When I debugged to find out my X and Y axis data points and compared them with what I find above in peakXCordInfoValue, then they don’t match. Ideally if I am finding the data point then it should match exactly.

I also tried to find index

var index = Contour.RenderableSeries[0].DataSeries.FindIndex(yDataForCoordinate, SearchMode.Nearest);

But it gives error “Operation is not valid due to the current state of the object.”
I also tried cursormodifier and its OnModifierMouseMove event, but it gives same error.

For Example: The actual data point on Y axis is 280.774501562118, and the above code returns 280.523009343212

Version
5.1.0.11299
  • You must to post comments
0
0

Hi Anil,

Thanks for your inquiry.

Please try our Hit-Test API. Please take a look at the corresponding documentation:
https://www.scichart.com/documentation/v5.x/webframe.html#RenderableSeries%20Hit-Test%20API.html

And our “Hit-Test API” example:
https://www.scichart.com/example/wpf-chart-example-hit-test-api/

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.