Pre loader

Keeping Y axis unchanged for ZoomPanModifier and ZoomExtentsModifier

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

Hi,

is it possible to keep the Y axis unchanged with ZoomPanModifier (XyDirection=”XDirection”) and ZoomExtentsModifier?

The RubberBandXyZoomModifier allows this by setting ZoomExtentsY to “False”, but i don’t know how to do this for ZoomPanModifier and ZoomExtentsModifier.

Thanks,
Robin

  • You must to post comments
0
0

Hello Robin,

yesterday I had to change that behavior in my application. Best way I found was to take out ZoomExtentsModifier and create a simple method that sets the visible range to minimum and maximum of that axis.
You will have to adapt a bit to your solution specially the GetCompleteRange (I have more then 1 yaxis)

hope it helps

<SciChart:SciChartSurface x:Name="chart"
                                  MouseDoubleClick="ModifierGroup_MouseDoubleClick"
                                  >
        private void ModifierGroup_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ZoomExtents();
        }
        public void ZoomExtents()
        {
            SetDistanceXAxisVisibleFullRange();
            SetSpeedYAxisVisibleRange();            
        }
        public void SetSpeedYAxisVisibleRange()
        {
            SpeedVsDistanceAxis.AutoRange = false;
            SpeedVsDistanceAxis.VisibleRange = new DoubleRange(0, Properties.Settings.Default.VMax);
        }
        /// <summary>
        /// sets the visible range of the X axis to the full range
        /// </summary>
        public void SetDistanceXAxisVisibleFullRange()
        {
            double xmin, xmax, ymin, ymax;
            GetCompleteRange(out xmin, out xmax, out ymin, out ymax);

            ((NumericAxis) chartDistanceSpeed.XAxis).VisibleRange = new DoubleRange(xmin, xmax);

        }
        public void GetCompleteRange(out double xmin, out double xmax, out double ymin, out double ymax)
        {
            DoubleRange range = ((NumericAxis)chartDistanceSpeed.XAxis).GetMaximumRange().AsDoubleRange();
            xmin = range.Min;
            xmax = range.Max;

            if (chartDistanceSpeed.YAxis == null)
                range = ((NumericAxis)chartDistanceSpeed.YAxes.GetAxisById("DefaultAxisId")).GetMaximumRange().AsDoubleRange();
            else 
                range = ((NumericAxis) chartDistanceSpeed.YAxis).GetMaximumRange().AsDoubleRange();
            ymin = range.Min;
            ymax = range.Max;
        }
  • Andreas Mueller-Bluemlein
    Hi Marcel, thank you, it helped! All i had to write was
    private void sciChart_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
    	XAxis.AnimatedVisibleRange = XAxis.GetMaximumRange();
    } 
    so i "regained" the ZoomExtentsModifier. The ZoomPanModifier is still missing but is also by far the less important modifier for me (at the moment). @SciChart Team: Nevertheless, it would be i nice feature to add the ZoomExtentsY property to both ZoomPanModifier and ZoomExtentsModifier. I wonder if i'm the first one with this usecase. Best regards, Robin
  • Andrew Burnett-Thompson
    Hi Robin, Noted - I've added a feature request. This is a fairly simple one so we can include in our minor updates. I can't recal if you're the first that has requested this, but quite often people ask for very small deviations from stock functionality. For that we often suggest overriding the modifier, but I looked at the code and it wasn't an easy one to do. Thanks Marcel for your assistance also! Regards, Andrew
  • cdicu
    Hi, I'm interested in this feature too : "add the ZoomExtentsY property to both ZoomPanModifier and ZoomExtentsModifier"
  • Andrew Burnett-Thompson
    Hello, Ok so 3 people asked for this (2 in the last 10 minutes), so we're going to do it to include in our next minor update. It's not a big piece of code. If you need it urgently can you contact me (via www.scichart.com/contact-us ) and I can send over a custom modifier? I understand you just need to prevent ZoomExtents in the Y-Direction for ZoomPanModifier (and possibly ZoomExtentsModifier), is that correct? Best regards, Andrew
  • cdicu
    Yes I would need the Y axis to stay unchanged when panning (using ZoomPanModifier with XyDirection="XDirection") ZoomExtentsModifier is less important because it can be easily done in a mouse handler (see a few posts before) I can wait for the next update, no problem; Thanks :)
  • Andrew Burnett-Thompson
    Hi cdicu, This work is done, if you would like to email us using the contact-form I can get you the new modifier code. Best regards, Andrew
  • 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