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: TRChart
Declaration: function DetectScale (CoordX, CoordY: 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 chart canvas. The function returns a zero value if the specified position is not within any scale of an axis. A non-zero value indicates that the position is within a scale. The (absolute) returned value is the index into the arrays ScalePropsX or ScalePropsY. A negative value indicates a horizontal axis (x axis), a positive value a vertical axis (y axis).

The function assumes that the scales are 50 pixels wide (vertical axes) and 40 pixels high (horizontal axes).

Example: Assume a chart with 3 x- and 3 y-axes and that the user clicks the location A, B and C (indicated by red crosses).
The function DetectScale will return -2 for location A (horizontal axis 2), 0 for location B (no axis), and +1 for location C (vertical axis 1).



Last Update: 2023-Dec-13