问题
I am using WPF DataVisualization chart control to show some sample data. My problem is Y axis is showing decimal values. How can I make it show only integer values.
This is my XAML code for the
<chartingToolkit:Chart Margin="0,30,0,30" Name="columnChart" Title="" Foreground="Black" >
<chartingToolkit:ColumnSeries DependentValuePath="Value" Background="Red"
IndependentValuePath="Key" ItemsSource="{Binding}" >
<chartingToolkit:ColumnSeries.DataPointStyle>
<Style TargetType="Control">
<Setter Property="Background" Value="#A80729"/>
</Style>
</chartingToolkit:ColumnSeries.DataPointStyle>
</chartingToolkit:ColumnSeries>
</chartingToolkit:Chart>
snapshot of the chat here
回答1:
set interval and Minimum,
some thing like,
<chartingToolkit:ColumnSeries.DependentRangeAxis>
<chartingToolkit:LinearAxis FontSize="15" Foreground="White" Interval="1" Minimum="0" Orientation="Y" ShowGridLines="False" />
</chartingToolkit:ColumnSeries.DependentRangeAxis>
<chartingToolkit:ColumnSeries.IndependentAxis>
<chartingToolkit:CategoryAxis FontSize="12" Foreground="Gray" Orientation="X" ShowGridLines="False" />
</chartingToolkit:ColumnSeries.IndependentAxis>
hope this helps!
来源:https://stackoverflow.com/questions/9342823/how-to-stop-showing-decimal-points-in-y-axis-in-wpf-datavisualization-charts