The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: TRChart
Declaration: function FindNearestItemAlongAxis (pos: double; Axis: TAxis; ItemID: TrcItem; ClassNumber: byte; var dist: double): longint;

The function FindNearestItemAlongAxis searches for the item which is closest to the positon pos along the axis specified by the parameter Axis, and which belongs to the item type ItemID, and has a class number of ClassNumber. In order to search through all items in the data container, ItemID should be set to tkEverything and ClassNumber must be 255.

The function returns the index of the closest item, which can be used to access the found item by means of GetItemParams, and SetItemParams. A value of -1 indicates that no element has been found. In addition, the variable parameter Dist contains the distance of the nearest item.

The distances between the reference position pos and the items of the chart are calculated using screen coordinates (pixels).

Last Update: 2014-Sep-12