Page 1 of 1

Add Array and Nan

Posted: Wed Dec 03, 2003 3:51 pm
by 6919588
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

Posted: Thu Dec 04, 2003 10:27 am
by Pep
>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 :

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
Josep Lluis Jorge
http://support.steema.com

Posted: Wed Dec 10, 2003 4:28 pm
by 9080016
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.