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

0
0

I have two draggable vertical “cursors” using the vertical line annotation as part of the vertical slice modifier. Works great except that as I zoom it becomes apparent the user is dragging the cursor between data points and the labels are showing the values of the line that extends between the points. Is there a away to “snap” the line to the data points like the rollover modifier does? Or alternately, is there a way to have multiple rollover modifiers (I need two cursors)?

  • You must to post comments
1
0

Hi David,

We don’t provide such capability out of the box, but it is possible to implement with a bit of customization (using our hit-test API):

public class VerticalLineEx : VerticalLineAnnotation
{
    protected override void MoveAnnotationTo(AnnotationCoordinates coordinates, double horizOffset, double vertOffset)
    {
        var series = ParentSurface.RenderableSeries[0];
        var hitTestResult = series.VerticalSliceHitTest(new Point(coordinates.X1Coord + horizOffset, 0));

        horizOffset = hitTestResult.HitTestPoint.X - coordinates.X1Coord;

        base.MoveAnnotationTo(coordinates, horizOffset, vertOffset);
    }
}

Please try the code above and let us know if it works as expected,

Best regards,
Yuriy

  • Philipp Holz
    Hi Yuriy, I also want the vertical slice modifier to snap to the datapoints and tried to implement your code example. Unfortunately I get an error that says, that there is no VerticalSliceHitTest in IRenderableSeries. Is your code example still up-to-date? Or am I missing another point? Thank you for your help. Best regards
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.