4

"I'm using the charts coming with the Winrt Xaml Toolkit. Despite some (xaml) errors most charts are displayed well. But the sacling of the axes isn't working. As soons as I try to define a min, max or interval value I get the following errror:

Failed to create a 'Windows.Foundation.IReference`1' from the text '1'

<charting:Chart x:Name="GradePointAverage" Title="Line Chart" Width="650" Height="650">
    <charting:Chart.Axes>
        <charting:LinearAxis Orientation="X" Title="x axis" Interval="1" Minimum="1" Maximum="6"    />
        <charting:LinearAxis Orientation="Y" Title="y axis"  ShowGridLines="True" />
    </charting:Chart.Axes>
    <charting:LineSeries ItemsSource="{Binding Items}" IndependentValueBinding="{Binding HalfYear}"
                            DependentValueBinding="{Binding Average}" IsSelectionEnabled="True" AnimationSequence="FirstToLast" TransitionDuration="0:0:5"   />
</charting:Chart>

Besides all charts are marked as "A value of type [chart type] cannot be added to a collection or dictionary of type 'collection`1'". I installed the toolkit through nuget and have already tried reinstalling.

Filip Skakun
  • 31,624
  • 6
  • 74
  • 100
Thrukal
  • 260
  • 5
  • 19

1 Answers1

1

I have had various problems too with setting the Minimum, Maximum and interval in xaml. But was able to fix it by doing it in C# instead. Something like this should probably work: (based of this: How to set axis margin in WinRT XAML Toolkit line chart?)

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

((LineSeries)GradePointAverage.Series[0]).DependentRangeAxis = new LinearAxis
                                                  {
                                                      Orientation = AxisOrientation.Y,
                                                      ShowGridLines = true
                                                  };
Community
  • 1
  • 1
Verbun
  • 31
  • 8