Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
Cant dispay a series on a chart c#
posted

Hi,

I'm having an issue displaying series on a chart without having things hardcoded in the xaml( I can easily display a series with hardcoded things in the xaml and setting the charts datacontext to my ObservableCollection). But as soon as try to create my own series in the code behind, and try to throw it onto the chart, nothing gets displayed.

Here is my code for creating a series/putting it on the chart.

C#:

var listOfPoints1 = new ObservableCollection<DataPoint>()

{
new DataPoint() {Subject ="subject_1", X = 0, Y = 25.68},
new DataPoint() {Subject ="subject_1",X = 35, Y = 5.68},
new DataPoint() {Subject ="subject_1",X = 58, Y = 45.56},
new DataPoint() {Subject ="subject_1",X = 65, Y = 70.68},
new DataPoint() {Subject ="subject_1",X = 165, Y = 125.68},
new DataPoint() {Subject ="subject_1",X = 265, Y = 555.68},
new DataPoint() {Subject ="subject_1",X = 400, Y = 325.68},
};
NumericXAxis x = new NumericXAxis();
NumericYAxis y = new NumericYAxis();

ScatterSplineSeries series = new ScatterSplineSeries();
series.XAxis = x;
series.YAxis = y;
series.XMemberPath = "X";
series.YMemberPath = "Y";
series.ItemsSource = listOfPoints1;
series.Title = "Subject 1";
series.Thickness = 3;
series.MarkerType = MarkerType.None;
xamChart1.Series.Add(series);

and my XAML looks like this:

<ig:XamDataChart Name="xamChart1" HorizontalZoomable="True" HorizontalZoombarVisibility="Collapsed" Padding="10"
VerticalZoomable="True" VerticalZoombarVisibility="Collapsed" >
<ig:XamDataChart.Axes>
<ig:NumericXAxis x:Name="ScatterSplineXAxis" />
<ig:NumericYAxis x:Name="ScatterSplineYAxis" />
</ig:XamDataChart.Axes>
<ig:XamDataChart.Series>

</ig:XamDataChart.Series>

</ig:XamDataChart>

Any help would be appreciated.

Thanks,

Nicolas

Parents Reply Children