Dave
Dave

Reputation: 434

Toolkit no decimals in chart Y-axis

I have the following problem:
I have a line and column chart where the numbers of the left Y-axis are auto generated. However I don't want any decimals at my Y-axis. Does anybody have an idea on how to hide these while still auto generating the numbers on the Y-axis and without any number standing in the axis twice?
Below is an image of the chart: The chart right now.

As you can see on the left it says *,5. I tried to set the interval of the left Y-axis to 1 but that doesn't work for me since the Y-axis is going to grow till about 300 (when it reaches 300 with an interval of 1 it means it is going to have 300 numbers on the left side that way it is not possible to read the text anymore). The graph is made with silverlight/wpf toolkit.
So what I think I need is a minimal interval or something that hides the decimals, this is of course just a guess)?
Here is my code:

<toolkit:Chart Margin="8,72,0,8" Title="Aantal meldingen per afdeling" x:Name="chartMeldingenPerAfdeling">
        <toolkit:Chart.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="White" Offset="0"/>
                <GradientStop Color="#FF476D88" Offset="1"/>
            </LinearGradientBrush>
        </toolkit:Chart.Background>
        <toolkit:ColumnSeries ItemsSource="{Binding}" DependentValuePath="AantalMeldingen"
                               IndependentValuePath="Afdeling" Margin="0,0,0,1" 
                           Title="Aantal meldingen" Padding="0" VerticalContentAlignment="Center" 
                           HorizontalContentAlignment="Center" FontSize="8"/>
        <toolkit:LineSeries ItemsSource="{Binding}" DependentValueBinding="{Binding Percentage}" DependentRangeAxis="{Binding ElementName=PercentageAxis}"
                            IndependentValueBinding="{Binding Afdeling}" IndependentAxis="{Binding ElementName=lin}" Title="Pareto"/>
        <toolkit:Chart.Axes>
            <toolkit:LinearAxis Orientation="Y" Location="Left" Title="Aantal" x:Name="AantalAxis"/>
            <toolkit:LinearAxis Orientation="Y" Location="Right" Title="Percentage" x:Name="PercentageAxis" Minimum="0" Maximum="100"/>
        </toolkit:Chart.Axes>
    </toolkit:Chart>

If you need any other information please let me know.
Thanks in advance.

EDIT:
Things I have tried:
Useing a string formater to make it so that it doesn't show deciamals, this however made it that some numbers were duplicated.
Setting a interval (this didn't work, if I use a static interval (1) there are too much numbers at the end (about 300).
How to stop showing decimal points in Y Axis in WPF DataVisualization charts

Upvotes: 0

Views: 1204

Answers (1)

user4116466
user4116466

Reputation:

Maby you can try to set the interval and the minimum:
How to stop showing decimal points in Y Axis in WPF DataVisualization charts
Else you might want to look at the following (this one is a string format you might want to use): {0:0.##}
LinearAxis without decimal numbers

Upvotes: 1

Related Questions