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
260
Create series dynamically
posted

Hello!

I'm new to DataChart, and have a following question.

I need to create a line chart with several series, like this:

Series1: { X: 0, Y:0; X:1, Y:5; X:2,Y:10; X:3, Y:15 }
Series2 may be like this: { X: 10, Y:10; X:11, Y:15; X:12,Y:110; X:13, Y:115 }
Series3 may also be something different.

Normally I'd do it like this:

for( i = 0; i < 3; i++ )
{
  series = new LineSeries();
  points = new points();

  for( // all points )
  {
    point = new point;
   // ....
    points.Add( point );
  }

  series.ItemSource = points;
  chart.Series.Add( series );
}

The question is -- what do I do with the XAxis? In the samples there is a line:

xmXAxis.ItemsSource = data;

But here it's not a simple data, it's an array of arrays of points. If I don't execute this line, the chart comes out empty. So, how whould I do this? Or would I better be off with WebChart in tis case (but what about performace?)?

Thanks in advance!