Add Array and Nan

TeeChart for ActiveX, COM and ASP
Post Reply
Rich
Newbie
Newbie
Posts: 4
Joined: Mon Aug 06, 2001 4:00 am
Location: chicago
Contact:

Add Array and Nan

Post by Rich » Wed Dec 03, 2003 3:51 pm

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Dec 04, 2003 10:27 am

>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

SS
Newbie
Newbie
Posts: 27
Joined: Thu Nov 27, 2003 5:00 am
Location: Chicago

Post by SS » Wed Dec 10, 2003 4:28 pm

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.

Post Reply