Pre loader

Prevent a VerticalLineAnnotation drag from unselecting a Series

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 a set of ChartModifiers on my SciChartSurface, carefully configured to work together like so:

<s:SciChartSurface.ChartModifier>
    <s:ModifierGroup>
        <s:LegendModifier x:Name="LegendModifier" />
        <s:ZoomPanModifier ExecuteOn="MouseRightButton" ClipModeX="None" />
        <s:RubberBandXyZoomModifier ExecuteOn="MouseLeftButton" />
        <s:SeriesSelectionModifier />
        <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
        <s:MouseWheelZoomModifier />
    </s:ModifierGroup>
</s:SciChartSurface.ChartModifier>

I also have a pair of VerticalLineAnnotations, which I create in the C#. These are used to select points on the series that has been selected with the SeriesSelectionModifier.

The problem is that after the sliders are dragged, the mouse up event causes the selected series to be unselected. How can I prevent this from happening?

  • You must to post comments
1
0

It’s a bit of a hack, but I’ve got a solution that works.

I used a custom SeriesSelectionModifier that could be instructed to ignore the next mouse up:

class CustomSeriesSelectionModifier : SeriesSelectionModifier
{
    public bool IgnoreNext { get; set; }

    public override void OnModifierMouseUp(ModifierMouseArgs e)
    {
        if (IgnoreNext == false)
        {
            IgnoreNext = false;
            base.OnModifierMouseUp(e);
        }
        IgnoreNext = false;
    }
}

and hooked that up to the DragEnded event on the VerticalLineAnnotation:

line.DragEnded += (sender, args) =>
{
    customSeriesSelectionModifier.IgnoreNext = true;
};

Of course I also had to use the custom ChartModifier in the xaml:

<s:SciChartSurface.ChartModifier>
    <s:ModifierGroup>
        <s:LegendModifier x:Name="LegendModifier" />
        <s:ZoomPanModifier ExecuteOn="MouseRightButton" ClipModeX="None" />
        <s:RubberBandXyZoomModifier ExecuteOn="MouseLeftButton" />
        <customChartModifiers:CustomSeriesSelectionModifier />
        <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick" />
        <s:MouseWheelZoomModifier />
    </s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
  • Andrew Burnett-Thompson
    I'm guessing this has something to do with the events used and ensuring the event is marked as e.Handled. Another thing you could do is handle VerticalLineAnnotation.MouseUp and ensure e.Handled is set to true. I'll mention this to the team and see if there is anything else we can do.
  • Robert Evans
    Thanks Andrew. I tried handling VerticalLineAnnotation.MouseUp and ensuring e.Handled is set to true, but doing that prevented the drag from completing properly.
  • 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