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
- Anil Soman asked 5 years ago
- last edited 5 years ago
- You must login to post comments
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/
- Oleksandr Shvets answered 5 years ago
- You must login to post comments
Please login first to submit.