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

0
0

When I yAxis.setVisibleRange(0.d,10.d) then add a series, it triggers AutoRange to resize the graph.

If the VisibleRange is ANYTHING other than 0,10 (even 0,10.001) then it doesn’t resize the graph.

during my search, I found that setting Axis.AutoRange to .NEVER will stop the issue from happening.

https://support.scichart.com/index.php?/Knowledgebase/Article/View/17203/31

I still wanted to post this here because this is a notable bug that others will come across, and I wanted to show what solution I found.

Version
2.2.2.2433
  • You must to post comments
0
0

Hi Peter,

I’m not sure that it’s a bug. This is part of default behavior which prevents setting of same range for axis and skips any updates in this case. By default axis is created with value provided by getDefaultNonZeroRange() ( for NumericAxis this is (0, 10) range ) and if you try to set the same range for axis nothing will happen. As result in this case AutoRange.Once mode which is used by default will be triggered as you start the chart.

To workaround this limitation you can try to create custom axis and pass alternative default non zero value via constructor:

class CustomNumericAxis extends NumericAxis {
    public CustomNumericAxis(Context context) {
        super(new DoubleRange(-100d, 100d), new AxisModifierSurface(context));
    }
}

Also you can create custom ViewportManager for chart and choose on your own when to perform auto range on axis:

class CustomViewportManager extends DefaultViewportManager {
    @Override
    protected void onApplyAutoRange(IAxis axis) {
        // super.onApplyAutoRange(axis);
        // set MaximumVisibleRange or some other range on axis
        // if auto range is requried and axis satisfies desired conditions
    }
}

Hope this will help you!

Best regards,
Yura

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.