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


Unit: SDL_rchart
Class: TRChart
Declaration: [1] procedure AutoRange (Layer: integer; Margin: double);
[2] procedure AutoRange (Layer: integer; Margin, MinRange: double);

The method AutoRange sets the bounds of the layer axes such, that all graphics elements of the layer specified by the parameter Layer are visible (i.e. can be displayed within the chart window) and the directions of the axes are positive. If Layer is zero, all visible layers are affected by the method, setting the axes of each layer to their optimum values. The parameter Margin specifies an optional margin in percent of the chart area. Values between 2 and 5 percent usually deliver good results. The optional parameter MinRange specifies the minimum required range in percent of the middle value of each axis (that is the average of the highest and the lowest value). This parameter can be used to prevent the chart from zooming too much into the data if the variation of the data in relation to the absolute values is low.

Please note that the width of lines, elements with relative pixel coordinates (such as DrawToRelPix), and the extents of text elements are not included in the autoranging calculations. Further, crosses contribute their centers, the lengths of the arms are only taken into account if a cross has been created using version [1] of the method Cross. This implies that crosses with pixel arm sizes (versions [2] and [3]) and lines  with a width greater than 1 may be displayed only partially (if the line element is the most outward element). The same is true for texts  which may be shown only partially since the text reference point depends on the TextAlignment property.

Hint 1: If the property Isometric is set TRUE, AutoRange adjusts only the x-axis and the lower bound of the y-axis. The upper bound of the y-axis is adjusted such that the resulting plot is isometric.

Hint 2: Please note that the number of layers is restricted to two in the Light Edition of the SDL Suite.

Example: This method is used in the following example program (see for downloading the code): duallayer, multilinreg, simplepca

Last Update: 2023-Dec-13