I have a simple SciChart surface that gets auto-zoomed by using AutoRange="Always"
, so as my data changes the XAxis and YAxis get recalculated so that all information on the chart can be shown.
However, the auto-range sets the XAxis and YAxis a little too small, causing some point markers to be cut off on the chart.
Is there a way I can add padding to the auto-range so that I can ensure all of my point markers are shown entirely?
Here is an example of the cutoff (check the points in the bottom-left and top-right corners):
My chart in XAML:
<s:SciChartSurface Grid.Column="1" x:Name="sciChartSurfaceScores"
ChartTitle="Scores Plot"
RenderableSeries="{s:SeriesBinding MySeries}">
<s:SciChartSurface.XAxis>
<s:NumericAxis AutoRange="Always" />
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis AutoRange="Always"/>
</s:SciChartSurface.YAxis>
<!-- Chart Modifiers -->
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<!-- Modifier - ZoomExtents -->
<s:ZoomExtentsModifier />
<s:RolloverModifier ShowTooltipOn="MouseHover"/>
<s:CursorModifier SnappingMode="TooltipToSeries"/>
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
CodePudding user response:
I can suggest use the GrowBy feature in SciChart. This adds a padding to the automatically calculated Axis ranges.
To do this, use this code:
<s:SciChartSurface.XAxis>
<s:NumericAxis AutoRange="Always" GrowBy="0.1, 0.1" />
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:NumericAxis AutoRange="Always" GrowBy="0.1, 0.1" />
</s:SciChartSurface.YAxis>
GrowBy is a fractional padding, so min=0.1, max=0.2 means '10% at the minimum visible range and 20% at the maximum'
Try playing with that property and see how it works out