我的图表运行良好,并且它正如我所希望的那样绘制我需要的11个点。然而,一旦情节出现,我特别感兴趣的是前3分。我想知道是否有办法让图表自动放大到绘制的前3个点,而不是在完成过程时有图表的完整比例视图。这是xaml:
<SciChart:SciChartSurface x:Name="sciChart"
Grid.Row="6"
SciChart:RenderSurfaceBase.RenderSurfaceType="Abt.Controls.SciChart.Rendering.HighQualityRasterizer.HighQualityRenderSurface"
SciChart:ThemeManager.Theme="BlackSteel"
Margin="-23,-2,-8,-18" Grid.ColumnSpan="6" Loaded="sciChart_Loaded">
<!-- Declare RenderableSeries -->
<SciChart:SciChartSurface.RenderableSeries>
<SciChart:FastLineRenderableSeries SeriesColor="LightBlue" StrokeThickness="2">
<SciChart:FastLineRenderableSeries.PointMarker>
<SciChart:EllipsePointMarker Width="9" Height="9" Stroke="LightBlue" Fill="#990077FF" StrokeThickness="2"/>
</SciChart:FastLineRenderableSeries.PointMarker>
</SciChart:FastLineRenderableSeries>
</SciChart:SciChartSurface.RenderableSeries>
<!-- Declare Axes -->
<SciChart:SciChartSurface.XAxis>
<SciChart:TimeSpanAxis AxisTitle="Time" GrowBy="0.1, 0.1" DrawMajorGridLines="True" DrawMinorGridLines="True" DrawMajorTicks="True" DrawMinorTicks="True" />
</SciChart:SciChartSurface.XAxis>
<SciChart:SciChartSurface.YAxis>
<SciChart:NumericAxis AxisAlignment="Left" AxisTitle=" % in Profit" GrowBy="0.1, 0.1" DrawMajorGridLines="True" DrawMinorGridLines="True" DrawMajorTicks="True" DrawMinorTicks="True"/>
</SciChart:SciChartSurface.YAxis>
是否可以使用Scichart的图表进行此操作?
答案 0 :(得分:3)
是的,您可以直接在SciChartSurface上操作XAxis.VisibleRange。要做到这一点,只需使用这样的代码
// Create your Data Series
var xyDataSeries = new XyDataSeries<TimeSpan, double>();
// Append some values
xyDataSeries.Append(TimeSpan.FromSeconds(0), 0);
xyDataSeries.Append(TimeSpan.FromSeconds(1), 1);
xyDataSeries.Append(TimeSpan.FromSeconds(2), 2);
// ...
xyDataSeries.Append(TimeSpan.FromSeconds(11), 11);
// Set the XyDataSeries on the RenderableSeries
// Assumes chart is created as per your XAML above
sciChart.RenderableSeries[0].DataSeries = xyDataSeries;
// Zoom XAxis to fit first three points
var xRange = new TimeSpanRange(xyDataSeries.XValues[0], xyDataSeries.XValues[2]);
sciChart.XAxis.VisibleRange = xRange;
// Zoom to fit in Y direction
sciChart.ZoomExtentsY();
希望这有帮助!
披露: 我是SciChart WPF Charts的主管和所有者