Pre loader

Zoom Limit (Repeated XAxis Value)

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

Hello there,

How I can set the zoom limit.Is it possible?
I try to avoid repeated XAxis value when zoomed

  • You must to post comments
1
0

Hi there,

It is now possible to set the AxisBase.VisibleRangeLimit in SciChart v3.0. This allows you to specify a maximum VisibleRange that the axis cannot exceed when zooming or panning.

Please see the SciChart v3.0 Release notes for more information.

8. Axis VisibleRangeLimit

  • Does not allow the axis to expand beyond the given AxisBase.VisibleRangeLimit.
  • Provides a reset-point for double-click Zoom Extents, overriding the built-in auto-ranging mechanism

Usage:



   

 

   


// Viewmodel properties declared as
private DoubleRange _xLimit;
 
public DoubleRange XLimit
{
    get { return _xLimit; }
    set
    {
        if (_xLimit == value) return;
        _xLimit = value;
        OnPropertyChanged("XLimit");
    }
}
 
private DoubleRange _yLimit;
 
public DoubleRange YLimit
{
    get { return _yLimit; }
    set
    {
        if (_yLimit == value) return;
        _yLimit = value;
        OnPropertyChanged("YLimit");
    }
}

Best regards,
Andrew

  • Ivan Schütz
    This is not usable though to define just a limit `delta`, right…? I have a real time chart, so and min/max is constantly changing…
  • You must to post comments
0
0

Hi there,

There is no build-in way to do this, but you can check visible range after change and constraint it in IAxis.VisibleRangeChanged handler. Something like this:

        XAxis.VisibleRangeChanged += OnVisibleRangeChanged;

        .....

        private void OnVisibleRangeChanged(object sender, VisibleRangeChangedEventArgs e)
        {
            var rangeLimit = 1;

            if (e.NewVisibleRange.AsDoubleRange().Diff < rangeLimit)
            {
                (sender as IAxis).VisibleRange = e.OldVisibleRange;
            }
        }

Or you can inherit from existing RubberBandXyZoomModifier, override OnModifierMouseUp and constraint new range there. Also this way allows you to change color of visible rectangle if zoomed range is not permitted, and similar features. You could take a look at our Usage of PaletteProvider example to see how custom zoom modifier is implemented there.

Please, don’t hesitate to ask if you need more assistance with this!

Best regards,
Yuriy

  • basalode
    I have try your suggestion solution but the code cause an overflow Exception whenever the zoom limit exceed the rangeLimit. Pls advise. Thanks,
  • Ivan Schütz
    Same here, also stack overflow on Android! I tried with `setVisibleRangeChangeListener` method, setting old range to axis or setting the min/max of `iRange1` (new range) to old range, both result in stack overflows. All I need is to set a min zoom level.
  • 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