Page 1 of 1

Null value and dynamic array

Posted: Fri Jul 01, 2005 1:54 pm
by 9337158
Hello,

I need a fast dynamic array (1000000 values). How is it possible to add Null values directly in a custom array ?

Regards
:?:

Posted: Mon Jul 04, 2005 8:05 am
by narcis
Hi stsl,

You cannot add arrays with null values (double.NaN in the example) directly into the chart, basically because:

1) there are many values which could be considered "null" values.
2) there are many ways in which a "null" value can be represented graphically.

So "null" values handling is up to you. However, you could do something like:

Code: Select all

private void Form1_Load(object sender, System.EventArgs e) 
{ 
tChart1.Series.Add(new Steema.TeeChart.Styles.FastLine());
Steema.TeeChart.Styles.FastLine fastLine1 = tChart1[0] as Steema.TeeChart.Styles.FastLine;
fastLine1.IgnoreNulls = false;
double[] array = new double[] {1, 2, 3, double.NaN, 5, 6};
int count=0;
foreach(double d in array) 
{
if(!double.IsNaN(d))
fastLine1.Add(count, d, Color.Red);
else
fastLine1.Add(count, 0, "Null",Color.Transparent);
count++;
}
} 
This is C# code but you shouldn't have much trouble translating it into Delphi/BCB. At the bottom of this article you'll find a Delphi example on how to use dynamic arrays. After populating the series with the dynamic arrays you could use Series1.AddNullXY(...) to add the "null" values to sthe series.