Page 1 of 1

Getting point indexes

Posted: Tue Jun 07, 2005 8:52 am
by 6922264
Hi!
I'd like to obtain the point indexes for the visible points in my chart.
The bottom axis is date-time and the left axis has doubles.
I've tried cht.Series(0).XValues.Locate(cht.Axis.bottom.Minimum) but it seems like there is no point at that exact value and so it returns -1 :(

TIA
/Kejpa

Posted: Tue Jun 07, 2005 9:29 am
by narcis
Hi Kejpa,

You can get those indexes and its value doing something like:

Code: Select all

Private Sub TChart1_OnAfterDraw()
    For j = TChart1.Series(0).FirstValueIndex To TChart1.Series(0).LastValueIndex - 1
        Label1.Caption = Label1.Caption + "Index: " + CStr(j) + ", " + CStr(TChart1.Series(0).XValues.Value(j))
    Next j
End Sub