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....



DetectScale


Unit:SDL_rchart
Class: TContourPlot
Declaration: [1] function DetectScale (CoordX, CoordY: integer): integer;
[2] function DetectScale (CoordX, CoordY, AssumedWidth, AssumedHeight: integer): integer;

The function DetectScale checks whether the position [CoordX,CoordY] is within a visible scale. The position is specified in pixel coordinates of the plot canvas. The function returns a zero value if the specified position is not within any scale of an axis. A value of -1 indicates that the position is within the x-scale, a value of +1 indicates that the position is within the y-scale.

Version [1] of the function assumes that the scales are 50 pixels wide (vertical axes) and 40 pixels high (horizontal axes), version [2] allows to set the capture range in pixels (properties AssumedHeight and AssumedWidth).

Example: Assume a contour plot with the x axis below the plot and the y axis right to it. The user clicks the location A, B, C, D and E (indicated by red crosses).
The function DetectScale will return -1 for location C (horizontal axis), 0 for locations A, B and E (no axis), and +1 for location D (vertical axis 1).



Last Update: 2024-Jan-05