Reputation: 369
How do I set the minimum/maxium/interval on the y axis on the chart - ColumnSeries
?
I'm using the WinRTXamlToolkit.Controls.DataVisualization.Charting
lib in a Windows 8.1 Store app.
The chart works fine without, but if I attempt to set Minimum
, Maximum
or Interval
it fails with following error: "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>
Upvotes: 1
Views: 1137
Reputation: 179
You can do this in code using something like this:
((LineSeries)LineChart.Series[0]).DependentRangeAxis = new LinearAxis()
{
Maximum = 50,
Minimum = 30,
Orientation = AxisOrientation.Y,
Interval = 20,
ShowGridLines = true,
};
Upvotes: 2