在 WinRTXamlToolkit 图表中为 Y 轴设置 min/max/interval

Setting min/max/interval for Y axis in a WinRTXamlToolkit Chart

如何在图表的 y 轴上设置 minimum/maxium/interval - ColumnSeries? 我在 Windows 8.1 商店应用程序中使用 WinRTXamlToolkit.Controls.DataVisualization.Charting 库。

图表在没有的情况下工作正常,但如果我尝试设置 MinimumMaximumInterval,它会失败并出现以下错误:"Cannot assign to nullable type on property Minimum"

<charting:Chart
    x:Name="BarChart2"
    Height="400"
    Title="title"
    Margin="0,0">
    <charting:ColumnSeries                      
        ItemsSource="{Binding items}"
        IndependentValueBinding="{Binding Initials}"
        DependentValueBinding="{Binding NumberOfVisits}"
        IsSelectionEnabled="True"  >                        
        <charting:ColumnSeries.DependentRangeAxis>
            <charting:LinearAxis
                Orientation="Y"
                Interval="1"
                Minimum="2"
                ShowGridLines="False"/>
        </charting:ColumnSeries.DependentRangeAxis>
    </charting:ColumnSeries>
</charting:Chart>

您可以使用如下代码在代码中执行此操作:

                    ((LineSeries)LineChart.Series[0]).DependentRangeAxis = new LinearAxis()
                {
                    Maximum = 50,
                    Minimum = 30,                        
                    Orientation = AxisOrientation.Y,
                    Interval = 20,
                    ShowGridLines = true,
                };