Hello there,
How I can set the zoom limit.Is it possible?
I try to avoid repeated XAxis value when zoomed
- basalode asked 11 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 10 years ago
-
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 login to post comments
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
- Yuriy Zadereckiy answered 11 years ago
-
I have try your suggestion solution but the code cause an overflow Exception whenever the zoom limit exceed the rangeLimit. Pls advise. Thanks,
-
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 login to post comments
Please login first to submit.