SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

0
0

I have CategoryDateAxis and whant to setup range limit from series size – 50 to series size + 10

mBottomAxis.setVisibleRangeLimit(new DoubleRange(series.size() - 50d, series.size() + 10d));
mBottomAxis.setVisibleRangeLimitMode(RangeClipMode.MinMax);

And this code works but not as I expected
When I scrol chalt and hits the range limit scroll is stopped BUT chart is zooming in

How to disable zooming when I hits the limit?

Version
2.1.0.2210
  • You must to post comments
0
0

Hi Evgeny,

Thanks for your enquiry.

Well this is how scroll is working by default for now. If you need different behavior you can always customize it by creating custom IAxisInteractivityHelper which is responsible for scrolling, zooming functionality of axis. Here is an example which should provide desired behavior:

    public static class CustomNumericAxis extends NumericAxis {

    public CustomNumericAxis(Context context) {
        super(context);
    }

    @Override
    protected IAxisInteractivityHelper createInteractivityHelper(ICoordinateCalculator currentCoordinateCalculator) {
        final IAxisInteractivityHelper defaultAxisInteractivityHelper = super.createInteractivityHelper(currentCoordinateCalculator);

        return new AxisInteractivityHelperWrapper(defaultAxisInteractivityHelper, this);
    }

    private static class AxisInteractivityHelperWrapper implements IAxisInteractivityHelper {

        private final IAxis axis;
        private final IAxisInteractivityHelper axisInteractivityHelper;

        public AxisInteractivityHelperWrapper(IAxisInteractivityHelper axisInteractivityHelper, IAxis axis) {
            this.axisInteractivityHelper = axisInteractivityHelper;
            this.axis = axis;
        }

        @Override
        public void zoom(IRange range, float fromCoord, float toCoord) {
            axisInteractivityHelper.zoom(range, fromCoord, toCoord);
        }

        @Override
        public void zoomBy(IRange range, double minFraction, double maxFraction) {
            axisInteractivityHelper.zoomBy(range, minFraction, maxFraction);
        }

        @Override
        public void scrollInMinDirection(IRange range, float pixels) {
            axisInteractivityHelper.scrollInMinDirection(range, pixels);

            axisInteractivityHelper.clipRange(range, axis.getVisibleRangeLimit(), ClipMode.ClipAtExtents);
        }

        @Override
        public void scrollInMaxDirection(IRange range, float pixels) {
            axisInteractivityHelper.scrollInMaxDirection(range, pixels);

            axisInteractivityHelper.clipRange(range, axis.getVisibleRangeLimit(), ClipMode.ClipAtExtents);
        }

        @Override
        public void scroll(IRange range, float pixels) {
            axisInteractivityHelper.scroll(range, pixels);

            axisInteractivityHelper.clipRange(range, axis.getVisibleRangeLimit(), ClipMode.ClipAtExtents);
        }

        @Override
        public <T extends Comparable<T>> void clipRange(IRange<T> range, IRange<T> maximumRange, ClipMode clipMode) {
            axisInteractivityHelper.clipRange(range, maximumRange, clipMode);
        }
    }
}

Please try it and let me know if it’s suitable for your needs.

Best regards,
Yura.

  • You must to post comments
0
0

Hi Evgeny,

I just remembered that I forgot to ask if you have tried to set ClipModeX for ZoomPanModifier:

 zoomPanModifier.setClipModeX(ClipMode.ClipAtExtents);

I believe it should provide the same result because by default ZoomPanModifier doesn’t apply any clipping

Best regards,
Yura

  • You must to post comments
0
0

Thank you very much for the quick reply
I checked this code and its works as i need
And I will try your second advice

  • You must to post comments
0
0

Second advice works as well
Thank you very much

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.