如何为YAxis设置固定的VisibleRange?

时间:2019-06-19 18:46:08

标签: c# wpf scichart

我正在尝试在YAxis上实现没有AutoRange的SciChart。但是,它似乎完全完全忽略了我的范围。

我尝试将YAxis设置为-5000到5000固定DoubleRange的NumericAxisViewModel,但是它始终显示0到10的范围。在逐步通过调试器时,我可以清楚地看到NumericAxis接受我的DoubleRange但是当图表最终呈现时,仅是0到10。此YAxis后来被添加到名为YAxes的Observable集合中,该集合绑定在XAML中。

轴构造

            this.YAxis = new NumericAxisViewModel
            {
                AxisAlignment = AxisAlignment.Left,
                DrawMajorGridLines = false,
                DrawMinorGridLines = false,
                DrawMajorBands = false,
                VisibleRange = new DoubleRange(5000, -5000),
                Visibility = Visibility.Visible,
                Id = channel.Id.ToString(),
            };

更高视图的模型正在收集数据

            foreach (IDataChannelViewModel d in this.Channels)
            {
                this.YAxes.Add(d.YAxis);
                this.RenderableSeries.Add(d.RenderableSeries);
                d.FifoCapacity = this.BufferSize;
            }

XAML正在绑定它。

        <sc:SciChartSurface x:Name="ChartSurface" Grid.Row="2" Grid.ColumnSpan="4" RenderableSeries="{sc:SeriesBinding RenderableSeries}" YAxes="{sc:AxesBinding YAxes}" Visibility="Hidden">
            <sc:SciChartSurface.XAxis>
                <sc:NumericAxis Name="XAxisControl" VisibleRange="{Binding SelectedRange}" DrawMajorGridLines="True" DrawMinorTicks="True"/>
            </sc:SciChartSurface.XAxis>
        </sc:SciChartSurface>

        <sc:SciChartSurface x:Name="OverviewSurface"
                            Background="White"
                            Grid.Row="2"
                            Grid.ColumnSpan="4"
                            Loaded="OnOverviewSurfaceLoaded"
                            RenderableSeries="{Binding ElementName=ChartSurface, Path=RenderableSeries}"
                            YAxes="{sc:AxesBinding YAxes}">
            <sc:SciChartSurface.XAxis>
                <sc:NumericAxis AutoRange="Always" DrawMajorGridLines="False" DrawMinorGridLines="False" DrawMajorBands="False" Visibility="Collapsed"/>
            </sc:SciChartSurface.XAxis>
        </sc:SciChartSurface>

我需要将其设置为5000到-5000的固定范围。

1 个答案:

答案 0 :(得分:0)

我为DoubleRange使用的构造函数不正确,最小值是第一,最大值是第二。