D = ((X-A)^2 + (Y-B)^2)
Here, X and Y are 1-D arrays of the x and y values of all points in the graph. D becomes is an array of distances squared.
Now search D for 0's if you know A and B are exactly on a point. Or use the Array Max and Min function if you just want to find the point closest to A,B, for example, if (A,B) is the position of a cursor placed near the point. In either case, you get an index of the point in the graph closest to (A,B).
David
Dear List, Does anyone know how to find out the index of a point in a XY graph? Thank you. Irene
===== Irene He
www.geocities.com/irene_he www.hytekautomation.com
-- David Ferster Actimetrics, Inc. 1621 Elmwood Ave., Wilmette, IL 60091 http://www.actimetrics.com 847/922-2643 Phone 847/589-8103 FAX
