Can you have a Nan in the YArray for Series.Addarray ?
I'm trying to get the equivalent of AddXY and AddNullXY but with better performance
Add Array and Nan
>Can you have a Nan in the YArray for Series.Addarray ?
Yes, but to add an YArray values which contains Nan values you should use something like the following code :
Josep Lluis Jorge
http://support.steema.com
Yes, but to add an YArray values which contains Nan values you should use something like the following code :
Code: Select all
Private Sub Form_Load()
Dim YValues
YValues = Array(3, 1, 8, NaN, 4, 7)
With TChart1
.AddSeries scLine
For i = 0 To UBound(YValues)
If YValues(i) = NaN Then
.Series(0).AddXY i, (YValues(i - 1) + YValues(i + 1)) / 2,
"NULL", clTeeColor
Else
.Series(0).AddXY i, YValues(i), "Pto:" & i, clTeeColor
End If
Next i
End With
End Sub
http://support.steema.com
We store everything in an internal array until we hit a null then we do an .AddArray of what we have accumulated so far, plot the null using .AddNullXY then continue building an internal array until the next null or end of series.
This seems to work great for us using FastLine Series, which now supports AddNullXY in version 6.
This seems to work great for us using FastLine Series, which now supports AddNullXY in version 6.