I have a dataseries I need to display on a log Axis – i have stripped out the <= 0 Y values and replaced them with NaN’s and set the chart to draw NaN’s as gaps which is all working as expected. The axis is a datetime x-axis and I’m plotting several Scatterseries on it.
I have a VerticalSliceModifier which the user sets to a particular point and the X value of that point is used to acquire further information from the database so for this feature the Y value is of no interest. I’ve overridden the MoveAnnotationTo() method in order to get the slicemodfier to “snap” to the next nearest point of any of the series shown.In order to do this I use :
HitTestInfo hitTestResult = _seriesToSnapTo.VerticalSliceHitTest(new Point(coordinates.X1Coord + horizOffset, 1));
The problem is that if the point is one of those with a Y Value of NaN the HitTestResult comes back as everything being “null” and I can’t get the XAxis Value i need.
I would have expected the HitTest to have returned an X value regardless of the Y value being a NaN. I really just want to snap to the next X Axis point ignoring the Y value. Is there something else I should be using to get the next X-axis point I need?
In the Knowledge Base, an article discusses a rollover modifier that utilises a vertical hit test to draw a vertical line at the cursor and highlight the nearest point: http://support.scichart.com/index.php?/Knowledgebase/Article/View/17235/32/custom-chartmodifiers—part-1—creating-a-custom-rollover-modifier
This is perfect for data which moves/is unique along the X axis (such as time series data).
How can I best replicate this modifier for data which moves/is unique along the Y axis? Drawing a horizontal line is easy, but there is no HorizontalSliceHitTest function.
Regarding Andrews comment on my question in this thread: https://www.scichart.com/questions/wpf/hittest-with-mvvm#sabai-entity-content-13177.
actually I need to know which nearest Y-value my XY line series has at the given VerticalLineAnnotationViewModel position. I need this value only for some calculation no need to show this on screen.
I found this post:
But neither your answer Andrew nor the suggested solution of Alitec Developer works for me. The VerticalSliceHitTest() returns always a HitTestInfo with default values and the FindIndex() approach is not suitable for me because I have unsorted data.