SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
I have two series on chart. I need to obtain data index for particular position. The problem is that ICoordinateCalculator.TransformDataToIndex seems to work only for first data serie in chart. It yields correct indexes as long as dataValue is in first data serie range. Outside that range it returns max/min index of this serie.
What I need is to obtain Y data values for particular X data value for all series. I tried using that function to get index and then read Y value from DataSerie, but maybe there is other approach for this issue.
The XML comment documentation for ICoordinateCalculator.TransformDataToIndex says this:
Takes a DateTime data-value and transforms to integer index on the axis e.g. if the axis is a CategoryDateTimeAxis, accepts DateTime, returns index. If the DateTime lies outside of the data-range, a projection is performed
We didn’t intend it to be used for all axis types (only CategoryDateTimeAxis to transform between DateTime and data index), although, it does seem pretty intuitive to pick up this method and use it, so I can’t blame you!
If you want to get the Y-value on a specific series for a specific X-Value, please use the RenderableSeries.HitTest method instead. Please can you call this as follows:
bool interpolateBetweenDataPoints = false; // If false, snaps to points. If true, snaps to line (between points) var hitTestInfo = renderableSeries.HitTest(currentPoint, interpolateBetweenDataPoints);
Finally, the documentation for HitTestInfo is here.
Please login first to submit.