Null value and dynamic array

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
stsl
Newbie
Newbie
Posts: 26
Joined: Mon Apr 19, 2004 4:00 am
Location: France

Null value and dynamic array

Post by stsl » Fri Jul 01, 2005 1:54 pm

Hello,

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

Regards
:?:

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jul 04, 2005 8:05 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply