2D XY chart using an array of doubles

Does anyone know how to make a really simple 2D XY chart by just providing 2 arrays of doubles (one for the X values and one for the Y values)? It needs to work with a C++ library that I already have and I want to keep the number of classes instantiated to a minimum so I'm trying to avoid creating a lot of other classes like DataSeries etc.


1 Reply

MP Michael Prabhu M Syncfusion Team August 29, 2011 01:51 PM UTC

Hi James,

Thanks for using Syncfusion Products.

We have analyzed your requirement and it can be achieved by applying the below code snippet.

Code Snippet[C#]:

double[] x = new double[] { 10, 20, 30, 40, 50, 60 };
double[] y = new double[] { 20, 30, 40, 50, 60, 70 };
for (int i = 0; i < 5; i++)
{
chart1.Add(new ChartPoint() { X = x[i], Y = y[i] });
}
Series2.Data = chart1;

We have also attached a sample based on your requirement.

Thanks,
Michael Prabhu



Arrayinchart_68e5a146.zip

Loader.
Up arrow icon