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



FindMinMax


Unit:SDL_rchart
Class: TRChart
Declaration: procedure FindMinMax (Layer: integer; RangeLoX, RangeLoY, RangeHiX, RangeHiY: double; var MinX, MinY, MaxX, MaxY: double);

The method FindMinMax finds the minimum and the maximum coordinates of all graphic elements of the layer Layer within the range defined by the parameters RangeLoX... RangeHiY. If Layer is set to zero, all layers are searched.

The minimum and maximum x and y values are returned in the variable parameters MinX, MinY, MaxX, and MaxY. The method FindMinMax enables the user to set the visible range of the chart in a way that all elements are visible within a given area.

Hint 1: FindMinMax does not take into account any elements which are specified by pixel coordinates (rather than by real coordinates), such as MoveToRelPix or DrawToRelPix.

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

Example: The following sample code finds the extreme values of all chart elements in the range [20,-uc_MaxDouble] to [40,+uc_MaxDouble] and sets the visible range of all layers such that all elements in the specified range are fully displayed.

var
  xLo, yLo, xHi, yHi: double;

begin
RChart1.FindMinMax (0, 20,-uc_MaxDouble,40, uc_MaxDouble, xLo, yLo, xHi, yHi);
RChart1.SetRange (0, xLo, yLo, xHi, yHi);
end;



Last Update: 2012-Oct-20