Search code examples
windows-8chartswindows-runtimewinrt-xamlwinrt-xaml-toolkit

How to eliminate displaying float values from WinRT XAML Toolkit chart if it is bound to integers?


enter image description here

I am using line chart from WinRT XAML Toolkit. Now my IndependentValueBinding is done from integer values from 1 to 5, but when it is displayed, it also shows floating values like 1.2, 1.4, 1.6, etc....

So how can I display only 1, 2, 3, 4 & 5 on the X axis.


Solution

  • UPDATE 1

    If you add IndependentAxis, then you will face clipping issue of data points, so here's solution for that.

    How to set axis margin in WinRT XAML Toolkit line chart?


    Finally I added this, and it worked.

    ((LineSeries)MyChart.Series[0]).IndependentAxis = new LinearAxis
                                                      {
                                                          Minimum = 1,
                                                          Maximum = 5,
                                                          Orientation = AxisOrientation.X,
                                                          Interval = 1
                                                      };