Jump to content
Software FX Community

Layer support


User (Legacy)

Recommended Posts

You can have multiple series in the same chart. Through the use of hidden 

points and X-Values you can simulate having series with different number of

points. You use the X-Values to align the points.

For example. If you have 5 points in one series and 3 in the other, you will

have something like:

chart.Data.Clear();

chart.Data.Series = 2;

chart.Data.Points = 10;

// First series

chart.Data.Y[0,0] = v1;

chart.Data.X[0,0] = x1;

chart.Data.Y[0,1] = v2;

chart.Data.Y[0,1] = x2;

chart.Data.Y[0,2] = v3;

chart.Data.Y[0,2] = x3;

chart.Data.Y[0,3] = v4;

chart.Data.X[0,3] = x4;

chart.Data.Y[0,4] = v5;

chart.Data.X[0,4] = x5;

// Second series

chart.Data.Y[1,0] = k1;

chart.Data.X[1,0] = x1;

chart.Data.Y[1,1] = k2;

chart.Data.Y[1,1] = x2;

chart.Data.Y[1,2] = k3;

chart.Data.Y[1,2] = x4; // Notice how X is used to align the series, in this

case point #3 in series 2 has the same X-value as point #4 in series 1.

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

  • 2 weeks later...

Your example gave me the follwoing results:

Code:

chart.Data.Clear();

chart.Data.Series = 2;

chart.Series[0].Gallery = Gallery.Lines;

chart.Series[1].Gallery = Gallery.Lines;

chart.Data.Points = 10;

// First series

chart.Data.Y[0, 0] = 10;

chart.Data.X[0, 0] = 10;

chart.Data.Y[0, 1] = 12;

chart.Data.Y[0, 1] = 12;

chart.Data.Y[0, 2] = 14;

chart.Data.Y[0, 2] = 14;

chart.Data.Y[0, 3] = 16;

chart.Data.X[0, 3] = 16;

chart.Data.Y[0, 4] = 18;

chart.Data.X[0, 4] = 18;

// Second series

chart.Data.Y[1, 0] = 20;

chart.Data.X[1, 0] = 10;

chart.Data.Y[1, 1] = 22;

chart.Data.Y[1, 1] = 12;

chart.Data.Y[1, 2] = 24;

chart.Data.Y[1, 2] = 14;

I didn´t expect these results...

Kind regards,

Alexei Dragoner (Shell Research and Development)

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message news:8ayz3zliGHA.1204@webserver3.softwarefx.com...

> You can have multiple series in the same chart. Through the use of hidden

> points and X-Values you can simulate having series with different number of

> points. You use the X-Values to align the points.

>

> For example. If you have 5 points in one series and 3 in the other, you will

> have something like:

>

> chart.Data.Clear();

> chart.Data.Series = 2;

> chart.Data.Points = 10;

>

> // First series

> chart.Data.Y[0,0] = v1;

> chart.Data.X[0,0] = x1;

> chart.Data.Y[0,1] = v2;

> chart.Data.Y[0,1] = x2;

> chart.Data.Y[0,2] = v3;

> chart.Data.Y[0,2] = x3;

> chart.Data.Y[0,3] = v4;

> chart.Data.X[0,3] = x4;

> chart.Data.Y[0,4] = v5;

> chart.Data.X[0,4] = x5;

>

> // Second series

> chart.Data.Y[1,0] = k1;

> chart.Data.X[1,0] = x1;

> chart.Data.Y[1,1] = k2;

> chart.Data.Y[1,1] = x2;

> chart.Data.Y[1,2] = k3;

> chart.Data.Y[1,2] = x4; // Notice how X is used to align the series, in this

> case point #3 in series 2 has the same X-value as point #4 in series 1.

>

> --

> Francisco Padron

> www.chartfx.com

>

>

Link to comment
Share on other sites

I realized there were some typos in my code, namely, the some X values were being assigned to Data.Y instead of Data.X:

chart.Data.Y[0,0] = v1;

chart.Data.X[0,0] = x1;

chart.Data.Y[0,1] = v2;

chart.Data.X[0,1] = x2; // HERE

chart.Data.Y[0,2] = v3;

chart.Data.X[0,2] = x3; // HERE

chart.Data.Y[0,3] = v4;

chart.Data.X[0,3] = x4;

chart.Data.Y[0,4] = v5;

chart.Data.X[0,4] = x5;

// Second series

chart.Data.Y[1,0] = k1;

chart.Data.X[1,0] = x1;

chart.Data.Y[1,1] = k2;

chart.Data.X[1,1] = x2; // HERE

chart.Data.Y[1,2] = k3;

chart.Data.X[1,2] = x4; // HERE

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...