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



ActiveLayer


Unit:SDL_rchart
Class:TRChart
Declaration:property ActiveLayer: integer;

The property ActiveLayer controls the currently active layer and may assume values between 1 and MAXNUMRCLAYERS. In general, drawing elements are always drawn on the currently active layer (without regard to the visibility of the active layer). In addition, the grid of a chart is always corresponding to the coordinate system of the active layer. Thus switching the active layer changes the grid.

The following properties, events and methods return information from the active layer or apply to the active layer: TickposX, TickPosY, TickNumX, TickNumY, OnMouseMoveInChart, MouseBox, MousePosX, MousePosY, FindNearestItemScreen.

Important Note: Changing the active layer triggers a repainting of the chart - which may reduce the performance of RChart to unacceptable levels, if the change of active layers is performed within loops. To cope with such situations, you should use the property SuppressPaint to prevent any redraws during drawing a chart.

Following is an example how to use SuppressPaint (please note, that changing SuppressPaint from false to true implicitely calls ShowGraf, so the usual ShowGraf at the end of the drawing routine is superfluos and would reduce the performance of RChart):

RChart1.SuppressPaint:= True;
RChart1.ClearGraf;
RChart1.SetRange(1, 0, -5.5, 120, 5.5);
OldY1:= 0;
OldY2:= 0;
for i := 1 to 200 do
  begin
  RChart1.ActiveLayer:= 1;
  RChart1.DataColor:= clBlue;
  NewY:= random*10-5;
  RChart1.Line(i-1, OldY1, i, NewY);
  OldY1:= NewY;
  RChart1.ActiveLayer:= 2;
  RChart1.DataColor:= clRed;
  NewY:= random*10-5;
  RChart1.Line(i-1, OldY2, i, NewY);
  OldY2:= NewY;
  end;
RChart1.SuppressPaint:= False;

Hint 1: In order to affect all layers when interactive panning and zooming is enabled (property MouseAction = maPan, maZoom, ....) you have to configure the array property MouseAffectsLayer accordingly.

Hint 2: In the Light Edition the number of layers is restricted to 2.

Example: This property is used in the following example programs (see http://www.lohninger.com/examples.html for downloading the code): duallayer, processc



Last Update: 2023-Dec-13