Page 1 of 1

How to change color in FastLine series

Posted: Mon May 22, 2006 6:42 am
by 9529132
Hi,

I am trying to set a threshold value for Y and if Y exceeds the threshold, the data should be added in red color. Otherwise, add data in green color. How to realize it for FastLine series?

Thank you very much!

David

Posted: Mon May 22, 2006 9:09 am
by narcis
Hi David,

This can not be done using a fast line series. Fast line only supports a unique color. However, you can do it by using a line series and something like this:

Code: Select all

Private Sub Form_Load()
    Dim val, threshold As Double
    
    threshold = 0.8
    
    With TChart1.Series(0)
        .ColorEachPoint = True

        For i = 0 To 100
            val = Rnd
            
            If val > threshold Then
                .Add Rnd, "", vbRed
            Else
                .Add Rnd, "", vbGreen
            End If
        Next
    End With
End Sub