Jump to content
Software FX Community

Scatter plot with multiple series


User (Legacy)

Recommended Posts

Ok, I´ve investigated the problem and here are my conclusions.

I have a function that creates the scatter plot. Here is a part of this

function:

=========================================================

public void Update_TilePanel()

{

base.Data.Clear();

base.Points.Clear();

object[] allArrays = new object[5];

double[] Array_A = new double[lstPoint_A.Count];

double[] Array_B = new double[lstPoint_B.Count];

double[] Array_C = new double[lstPoint_C.Count];

double[] Array_Neutral = new double[lstPoint_Neutral.Count];

double[] XArray = new double[lstPoint_A.Count];

allArrays[0] = Array_A;

allArrays[1] = Array_B;

allArrays[2] = Array_C;

allArrays[3] = Array_Neutral;

allArrays[4] = XArray;

base.DataSourceSettings.Fields.Add(new FieldMap("Field1",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field2",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field3",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field4",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field5",

FieldUsage.XValue));

ListProvider lstProvider = new ListProvider(allArrays);

base.DataSourceSettings.DataSource = lstProvider;

}

==========================================================

The first time this function runs, only two series are displayed on my

scatter plot. When I right-clik the plot, and select "Data Grid",

I see that only two series have correct "X" and "Y" values, and the other

two series (Phase C and Neutral) have "Y-Values" but no

"X-Values" (see attached picture). Plus, I see 4 other series that have

Y-values but no X-Values, and I have no idea where these series come from

(see attached picture) The second time the function runs, Serie3 (PhaseC)

now has correct "X-Values" but two other series are created, with no

X-values... so I now have 8 series, but only 3 of them are correct. And the

third time I run the function, all the series are generetaed correctly, but

I have now 10 series, the 6 last have no X-Values. So I really don´t know

why my 4 series are not displayed

correctly the first time the functions is run, and why other series are

generated.

Thank you very much for your kind help.

Regards,

Olivier Voyer

"Olivier" <olivier.voyer@cyme.com> wrote in message

news:XC$ndRvxGHA.1280@webserver3.softwarefx.com...

> Hello,

>

> I have a scatter plot. When I write the following code, everything works

> fine. But this code isn´t correct because if I have two points that have

> the

> same X-Value, these pointes will not be set correctly.

>

> ===================================================

>

> object[] allArrays = new object[5];

> double[] Array_A = new double[lstPoint_A.Count];

> double[] Array_B = new double[lstPoint_B.Count];

> double[] Array_C = new double[lstPoint_C.Count];

> double[] Array_Neutral = new double[lstPoint_Neutral.Count];

> String[] XArray = new String[lstPoint_A.Count];

>

> allArrays[0] = Array_A;

> allArrays[1] = Array_B;

> allArrays[2] = Array_C;

> allArrays[3] = Array_Neutral;

> allArrays[4] = XArray;

>

> ListProvider lstProvider = new ListProvider(allArrays);

> base.DataSourceSettings.DataSource = lstProvider;

>

> ======================================================

>

> So I wrote a code that use the X-Value. But when I write this other code

> (see below), I don´t get a correct plot. I get a plot that contains only

> two

> sets of points, instead of 4...

>

> ======================================================

>

> object[] allArrays = new object[5];

> double[] Array_A = new double[lstPoint_A.Count];

> double[] Array_B = new double[lstPoint_B.Count];

> double[] Array_C = new double[lstPoint_C.Count];

> double[] Array_Neutral = new double[lstPoint_Neutral.Count];

> double[] XArray = new double[lstPoint_A.Count];

>

> allArrays[0] = Array_A;

> allArrays[1] = Array_B;

> allArrays[2] = Array_C;

> allArrays[3] = Array_Neutral;

> allArrays[4] = XArray;

>

> base.DataSourceSettings.Fields.Add(new FieldMap("Field1",

> FieldUsage.Value));

> base.DataSourceSettings.Fields.Add(new FieldMap("Field2",

> FieldUsage.Value));

> base.DataSourceSettings.Fields.Add(new FieldMap("Field3",

> FieldUsage.Value));

> base.DataSourceSettings.Fields.Add(new FieldMap("Field4",

> FieldUsage.Value));

> base.DataSourceSettings.Fields.Add(new FieldMap("Field5",

> FieldUsage.XValue));

>

> ListProvider lstProvider = new ListProvider(allArrays);

> base.DataSourceSettings.DataSource = lstProvider;

>

> ========================================================

>

> What am I doing wrong?

>

> Thx!

>

>

> --

> Olivier Voyer

> CYME International T&D

>

>

Link to comment
Share on other sites

Francisco,

Thank you very much, I added "base.DataSourceSettings.Fields.Clear();" and

everything works fine.

Regards,

Olivier

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:ueebBp5xGHA.1292@webserver3.softwarefx.com...

> Also try this before setting the DataSource:

>

> chart.Data.X.Shared = true;

>

> --

> Francisco Padron

> www.chartfx.com

>

Link to comment
Share on other sites

  • 4 weeks later...

Hello,

I have a scatter plot. When I write the following code, everything works

fine. But this code isn't correct because if I have two points that have the

same X-Value, these pointes will not be set correctly.

===================================================

object[] allArrays = new object[5];

double[] Array_A = new double[lstPoint_A.Count];

double[] Array_B = new double[lstPoint_B.Count];

double[] Array_C = new double[lstPoint_C.Count];

double[] Array_Neutral = new double[lstPoint_Neutral.Count];

String[] XArray = new String[lstPoint_A.Count];

allArrays[0] = Array_A;

allArrays[1] = Array_B;

allArrays[2] = Array_C;

allArrays[3] = Array_Neutral;

allArrays[4] = XArray;

ListProvider lstProvider = new ListProvider(allArrays);

base.DataSourceSettings.DataSource = lstProvider;

======================================================

So I wrote a code that use the X-Value. But when I write this other code

(see below), I don't get a correct plot. I get a plot that contains only two

sets of points, instead of 4...

======================================================

object[] allArrays = new object[5];

double[] Array_A = new double[lstPoint_A.Count];

double[] Array_B = new double[lstPoint_B.Count];

double[] Array_C = new double[lstPoint_C.Count];

double[] Array_Neutral = new double[lstPoint_Neutral.Count];

double[] XArray = new double[lstPoint_A.Count];

allArrays[0] = Array_A;

allArrays[1] = Array_B;

allArrays[2] = Array_C;

allArrays[3] = Array_Neutral;

allArrays[4] = XArray;

base.DataSourceSettings.Fields.Add(new FieldMap("Field1",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field2",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field3",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field4",

FieldUsage.Value));

base.DataSourceSettings.Fields.Add(new FieldMap("Field5",

FieldUsage.XValue));

ListProvider lstProvider = new ListProvider(allArrays);

base.DataSourceSettings.DataSource = lstProvider;

========================================================

What am I doing wrong?

Thx!

--

Olivier Voyer

CYME International T&D

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...