Search code examples
wpfchartstoolkit

WPF Toolkit Chart Y-Axis Descending sort order


I want to reverse Y-Axis in my WPF Chart object. https://i.sstatic.net/M0oaA.jpg

For this I trying use this xaml code:

<my:Chart Name="chart1">
            <my:Chart.Axes>
                <my:CategoryAxis Orientation="Y" ShowGridLines="True" SortOrder="Descending" />
                <my:CategoryAxis Orientation="X" />
            </my:Chart.Axes>
            <my:Chart.Series>
                <my:LineSeries x:Name="ser"
                               IndependentValueBinding="{Binding Value}"
                               DependentValueBinding="{Binding Key}" AnimationSequence="FirstToLast" />
            </my:Chart.Series>
        </my:Chart>

And there is a databinding:

Dictionary<int, int> source2 = new Dictionary<int, int>();
            source2.Add(13, 1);
            source2.Add(23, 2);
            source2.Add(33, 3);
            source2.Add(10, 4);

            ser.ItemsSource = source2;

But in result my Y-Axis has normal ascending sord order. What I do wrong? Thanks;


Solution

  • I found solution for my problem in official chart sample application with some IValueConverter and special y-Axis format. Thanks :).

    http://dlaa.me/blog/post/9607895