Pre loader

ZoomExtends on either yaxis or chart

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

Answered
2
0

Hi,
I have a SciChartSurfacewith one xaxis an four yaxis and a dynamic number of series which are added at runtime.
Also I have some modifiers especially the ZoomExtentsModifier( ExecuteOn=”MouseDoubleClick” XyDirection=”XDirection”) and for each yaxis a yaxisdragmodifier.
Is it possible to double click on a single yaxis and ZoomExtends only this yaxis?

Regards Markus

  • You must to post comments
Best Answer
2
0

Hi Markus,

I think you’ll need to create a custom modifier to do this, but it shouldn’t be too hard. Head over to our KnowledgeBase to see articles on Custom Chart Modifiers.

If you come up with a good solution, feel free to post it here as a code sample!

Best regards,
Andrew

  • You must to post comments
Great Answer
2
0

So here is my CustomZoomExtendsModifier:

Depending on where you make a double click (Chart, XAxis, YAxis) it zooms to its maximum range.

public class CustomZoomExtendsModifier : ChartModifierBase
{
    public override void OnModifierDoubleClick(ModifierMouseArgs e)
    {
        bool isOnChart = IsPointWithinBounds(e.MousePoint, ModifierSurface);

        foreach(var yAxis in YAxes)
        {
            if(IsPointWithinBounds(e.MousePoint, yAxis))
            {
                var range = yAxis.GetMaximumRange();
                yAxis.AnimateVisibleRangeTo(range, TimeSpan.FromMilliseconds(500));
            }             
        }

        foreach(var xAxis in XAxes)
        {
            if(IsPointWithinBounds(e.MousePoint, xAxis))
            {
                var range = xAxis.GetMaximumRange();
                xAxis.AnimateVisibleRangeTo(range, TimeSpan.FromMilliseconds(500));
            }             
        }

        if(isOnChart)
        {
            this.ParentSurface.AnimateZoomExtents(TimeSpan.FromMilliseconds(500));
        } 

        e.Handled = true;
        base.OnModifierDoubleClick(e);
    }
}

Regards Markus

  • You must to post comments
Showing 2 results
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