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


I would like to get the Y-value of a line, corresponding to a given X-value as input. The x-value is coming from a cursor (VerticalLineAnnotation) that the user drags on the chart.

Noting that the given X-value may not necessarily be within the input table of X versus Y values, meaning that some kind of interpolation may be needed to compute the Y-value, is there a SciChart API for getting this Y-value corresponding to a given X-value? Rather than me performing the interpolation through code.

We are using the LineRenderableSeriesViewModel, which is databound to the RenderableSeries of the SciChartSurface so at the viewmodel we don’t really have access to the RenderableDataSeries used by the chart. The viewmodel, however, is where we are data binding to the needed Y-value.

Here is a sampling of the code:

    <s:SciChartSurface x:Name="_sciChartSurface" RenderableSeries="{s:SeriesBinding PlotViewModels}"  
                       YAxes="{s:AxesBinding VerticalAxes}" ZoomState="{Binding ZoomState, Mode=TwoWay}"
                       Margin="{Binding ChartMargin, ElementName=_root}"
                       BorderBrush="{Binding ChartBorderBrush, ElementName=_root}"
                       BorderThickness="{Binding ChartBorderThickness, ElementName=_root}"
                       RenderPriority="Low" MaxFrameRate="12">

 public class PlotViewModel : LineRenderableSeriesViewModel, IDisposable {
        XyDataSeries<DateTime, double> _dataSeries = new XyDataSeries<DateTime, double>();

    public string Cursor1Value =>

          public void SetCursorDates(DateTime cursor1Date, DateTime cursor2Date) {
        _cursor1Date = cursor1Date;
        _cursor2Date = cursor2Date;

    double CalculateValues(DateTime cursor1Date) {
        //need to get to the HitTest API


  • You must to post comments

Hi Patrick,

Thanks for your question.

Unfortunately, there is no way to hit-test RenderableSeriesViewModel at the moment. Desired hit-test is possible on RenderableSeries instance through HitTestProvider.VerticalSliceHitTest(..) method.

There are several ways to implement this using MVVM. You could create a custom Behavior on SciChartSurface or a custom ChartModifier that would subscribe to Drag events of VerticalLine and perform hit-test on all RenderableSeries inside. Then the result can be exposed via a bindable property or an event.

Alternatively, you can extend VerticalLineAnnotation itself and override OnDragDelta(). Likewise, perform hit-test on all RenderableSeries there and expose the result.

Hope this helps!

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.