How to stop showing decimal points in Y Axis in WPF DataVisualization charts

前提是你 提交于 2019-12-23 21:01:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!