Pre loader

Support YAxis Auto scale

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 want YAxis Auto Scale less than the value max 10% and greater value min 10%, how?

  • You must to post comments

Ok I’ve investigated this and there’s a couple of ways to do it. The code to achieve a positive padding (e.g. 10% above max, and 10% below min) is as follows:

// C#
var axis = new NumericAxis();
axis.AutoRange = true
axis.GrowBy = new DoubleRange(0.1, 0.1);


<!-- XAML -->
<NumericAxis AutoRange="True" GrowBy="0.1, 0.1"/> 

You could try this with negative values but we haven’t tested it.

A more advanced solution is to create a custom ViewportManager.

See class DefaultViewportManager in SciChart. If you inherit this, you can override how the YAxis and XAxis ranges are set during each redraw.


public class MyViewportManager : DefaultViewportManager
    protected override IRange OnCalculateNewYRange(IAxis yAxis, RenderPassInfo renderPassInfo)
        // If Axis.AutoRange = true, then this is the zoomed to fit VisibleRange
        var rawAutoRange = base.OnCalculateNewYRange(yAxis, renderPassInfo);
        // Shrink this by a factor and return - to scichart core rendering
        return rawAutoRange.GrowBy(new DoubleRange(-0.1, -0.1));

The usage of a ViewportManager is as follows

SciChartSurface.ViewportManager = new MyViewportManager();

Let me know which solution you used, and if they did the job!

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.