IValueList.Locate
IValueList
function Locate(SomeValue: Double): Integer;
Type Library
TeeChartx
Description
This new function returns the corresponding point index which has the specified "Value". You can use it to calculate X co-ordinates based on Y values or vice-versa:
Example [Visual Basic]:
'Add some series points
Private Sub Command1_Click()
With TChart1.Series( 0 )
.AddXY (DateValue("1996,1,1")), 3, "", clTeeColor
.AddXY (DateValue("1996,3,1")), 8, "", clTeeColor
.AddXY (DateValue("1996,5,1")), 6, "", clTeeColor
.AddXY (DateValue("1996,7,1")), 7, "", clTeeColor
.AddXY (DateValue("1996,9,1")), 2, "", clTeeColor
.AddXY (DateValue("1996,11,1")), 9, "", clTeeColor
End With
End Sub
'Find the point value !
Private Sub Command2_Click()
Dim tmp As Integer
tmp = TChart1.Series( 0 ).XValues.Locate(DateValue("1996,9,1"))
If tmp <> -1 Then
MsgBox (Str$(TChart1.Series( 0 ).YValues.Value(tmp)))
End If
End Sub