I have a Model with an array[100] of double and I would like to use this directly as the data for the chart. The index value should be the X and the value at that index should be the Y on the chart.
Currently I have to convert the array to a list of points (in my ViewModel) where I store the index value (0-99) as the X of the point and the value of that array index as the Y value of the point.
My xaml looks like this :
<UserControl.DataContext>
        <local:ViewModel/>
    </UserControl.DataContext>
    <Grid>
        <syncfusion:SfChart>
            <chart:SfChart.PrimaryAxis>
                <chart:NumericalAxis/>
            </chart:SfChart.PrimaryAxis>
            <chart:SfChart.SecondaryAxis>
                <chart:NumericalAxis/>
            </chart:SfChart.SecondaryAxis>
            <chart:LineSeries ItemsSource="{Binding Data}" XBindingPath="X" YBindingPath="Y"/>
        </syncfusion:SfChart>
    </Grid>
</UserControl>
I cannot imagine that this is the best way to get the result ...
 
                        
Well, the only way to let the control know this is to create an object with a property that returns the X value and another that returns the Y value and then set the
XBindingPathandYBindingPathto the names of these respectively. This is MVVM.The control cannot really be supposed to figure out that you want the index to represent the Y value.