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.

1
0

I want YAxis Auto Scale less than the value max 10% and greater value min 10%, how?

  • You must to post comments
0
0

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);

or

<!-- 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.

e.g.

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,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.