how to get knee points?

TeeChart for ActiveX, COM and ASP
Post Reply
zrandlbs
Newbie
Newbie
Posts: 37
Joined: Thu Dec 05, 2013 12:00 am

how to get knee points?

Post by zrandlbs » Wed Jan 08, 2014 2:51 am

Hi,
After I draw a curve,is there any way or function that I can get knee points of the curve?
Thanks,
Robinson

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: how to get knee points?

Post by Narcís » Thu Jan 09, 2014 8:56 am

Hi Robinson,

There's no way to do this automatically. However, you can easily do that comparing series points like this:

Code: Select all

Private Sub Form_Load()
    TChart1.Aspect.View3D = False
    TChart1.AddSeries scLine
    TChart1.Series(0).FillSampleValues 100
    
    TChart1.AddSeries scPoint
    
    Dim Ascending As Boolean
    
    For i = 2 To TChart1.Series(0).Count
        Ascending = False
        
        If TChart1.Series(0).YValues.Value(i - 2) < TChart1.Series(0).YValues.Value(i - 1) Then
            Ascending = True
        End If
        
        If Ascending And (TChart1.Series(0).YValues.Value(i - 1) > TChart1.Series(0).YValues.Value(i)) Then
            TChart1.Series(1).AddXY TChart1.Series(0).XValues.Value(i - 1), TChart1.Series(0).YValues.Value(i - 1), "", clTeeColor
        End If
                
        If Not Ascending And (TChart1.Series(0).YValues.Value(i - 1) < TChart1.Series(0).YValues.Value(i)) Then
            TChart1.Series(1).AddXY TChart1.Series(0).XValues.Value(i - 1), TChart1.Series(0).YValues.Value(i - 1), "", clTeeColor
        End If
    Next i
End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

zrandlbs
Newbie
Newbie
Posts: 37
Joined: Thu Dec 05, 2013 12:00 am

Re: how to get knee points?

Post by zrandlbs » Sun Jan 12, 2014 11:13 pm

Hi,Narcís Calvet
THank you,you code gave me a way to solve it.
Cheers,
Robinson,

Post Reply