Hello,
I need a fast dynamic array (1000000 values). How is it possible to add Null values directly in a custom array ?
Regards
Null value and dynamic array
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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:
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.
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++;
}
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |