Page 1 of 1

Send to back/front

Posted: Tue May 25, 2004 9:30 am
by 5887120
Hi,

How do you send series back and forward on the chart, e.g. I have a chart with 5 series on it (A,B,C,D,E) I now want the order on the chart to be B-C-A-D-E thus moving the A series down by 2 in the display order on the chart - is there something like a layermanager or something ? I need to do it runtime.

regards

-Torben (using Delphi 7.1 & Teechart 6)

Posted: Tue May 25, 2004 10:19 am
by 5887120
P.S.

Hi again - tried the following which didn't work. Button 2 should move series A up...or ... ?

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, StdCtrls, ExtCtrls, TeeProcs, Chart;

type
TForm1 = class(TForm)
Chart1: TChart;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
ASeries: TLineSeries;
BSeries: TLineSeries;
CSeries: TLineSeries;

public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
I : Integer;
begin
ASeries:= TLineSeries.Create(Chart1);
BSeries:= TLineSeries.Create(Chart1);
CSeries:= TLineSeries.Create(Chart1);
for I := 0 to 100 do begin
ASeries.AddXY(I,sin(I),'',clRed);
BSeries.AddXY(I,sin(I),'',clGreen);
CSeries.AddXY(I,sin(I),'',clBlue);
end;
ASeries.ParentChart := Chart1;
BSeries.ParentChart := Chart1;
CSeries.ParentChart := Chart1;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Chart1.SeriesUp(ASeries);
end;

end.

Posted: Tue May 25, 2004 11:27 am
by Pep
Hi,

to do this you should use the ExchangeSeries method. Please see the Help for details.