Pre loader

Limiting dragging of a vertical line annotation in a vertical slice modifier to the actual data points?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies