I want YAxis Auto Scale less than the value max 10% and greater value min 10%, how?
- kingsoff asked 12 years ago
- last edited 10 years ago
- You must login 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);
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
- Andrew Burnett-Thompson answered 12 years ago
- You must login to post comments
Please login first to submit.