Page 1 of 1

how to get knee points?

Posted: Wed Jan 08, 2014 2:51 am
by 16667970
Hi,
After I draw a curve,is there any way or function that I can get knee points of the curve?
Thanks,
Robinson

Re: how to get knee points?

Posted: Thu Jan 09, 2014 8:56 am
by narcis
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

Re: how to get knee points?

Posted: Sun Jan 12, 2014 11:13 pm
by 16667970
Hi,NarcĂ­s Calvet
THank you,you code gave me a way to solve it.
Cheers,
Robinson,