Pre loader

setVisibleRangeLimitMode() on XAxis

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


I have stock charts and want to prevent the user to go beyond the Min/Max datetimes (left, right). I tried applying setVisibleRangeLimitMode() to XAxis but it has no effect:

private final DoubleRange sharedXRange = new DoubleRange();

//sharedXRange.setMinMax(0d, response.body().getData().size()-1d); // not helping
final CategoryDateAxis xAxis = sciChartBuilder.newCategoryDateAxis()
        .withVisibility(isMainPane ? View.VISIBLE : View.GONE)
        .withGrowBy(0.1d, 0.1d)

xAxis.setMinimalZoomConstrain(10d); // minimum 10 points
xAxis.setVisibleRangeLimitMode(RangeClipMode.MinMax); // not working
//xAxis.setVisibleRangeLimit(new DoubleRange(-5d,5d));

I am thinking that maybe I should set Min and Max to sharedXRange, but couldn’t find in the docs what value to put into (tried with index, and Date without luck).

  • Primoz
    Let me also point out that I am premium user (here it says my Tiral expired??), my order ID is ABT181022-9293-43119.
  • You must to post comments

Hi Primos,

By default VisibleRangeLimit isn’t applied when you set VisibleRange because we assume that when you set it manually then you know what you’re doing. VisibleRangeLimit is applied during auto range calculations and modifier interaction ( when you scroll, zoom or pan chart ) when VisibleRange is changed indirectly.

If you want to apply VisibleRangeLimit anyway you can create custom axis and override method which checks whether new VisibleRange value satisfies constrains and add check for limit. Then you can override coerceVisibleRange() method which is called when check is failed and apply VisibleRangeLimit constrain there:

    class CustomCategoryDateAxis extends CategoryDateAxis {
    public CustomCategoryDateAxis(Context context) {

    protected boolean isZoomConstrainSatisfied(IRange<Double> range) {
        final IRange<Double> limit = getVisibleRangeLimit();

        final boolean isRangeWithinLimit = limit == null || (limit.isValueWithinRange(range.getMin()) && limit.isValueWithinRange(range.getMax()));

        return isRangeWithinLimit && super.isZoomConstrainSatisfied(range);

    protected void coerceVisibleRange(IRange<Double> visibleRange) {


Hope this will help you!

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.