I want to avoid from decimal numbers in my Axis, how can I do that ?
XAML:
<Charting:Chart VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch">
<Charting:Chart.Axes>
<Charting:LinearAxis Orientation="Y" Minimum="0" Title="" Location="Left"
/>
</Charting:Chart.Axes>
<Charting:Chart.Series>
<Charting:ColumnSeries ItemsSource="{Binding Persons}"
DependentValueBinding="{Binding Count}"
IndependentValueBinding="{Binding Category}">
</Charting:ColumnSeries>
</Charting:Chart.Series>
</Charting:Chart>
In case you're still struggling on this, or if anyone else is interested: the solution is almost what baalazamon wrote. It's just that {0:0.##} will display two decimal digits if they exists (that's what ".##" means). So what you should write is
<Style x:Key="EmptyStyle" TargetType="charting:NumericAxisLabel">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="StringFormat" Value="{0:0}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="charting:NumericAxisLabel">
<TextBlock />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
And of course you need to add this:
<charting:LineSeries.DependentRangeAxis>
<charting:LinearAxis AxisLabelStyle="{StaticResource EmptyStyle}"
Orientation="Y"
ShowGridLines="True"/>
</charting:LineSeries.DependentRangeAxis>
I hope this will solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With