Many charts on a form
Posted: Fri Dec 08, 2006 10:14 pm
I have a form with 32 Teecharts, and each chart has 5 tlineseries. In order to make accessing chart properties easier in code I've created an array of charts in form create, and assigned these to the charts I place on form at design time. See code below. My question is, is this good practice, and do I need to free the charts aray in form close event.
type
Tmyfrm = class(TForm)
.
.
private
mycharts:array[1..32] of tchart;
procedure Tmyfrm.create(sender:TObject);
var
i:nteger;
begin
for i:=1 to chartcount do
charts:=Tchart.create(self);
charts[1]:=chart1;
charts[2]:=chart2
etc
end;
Can the access charts by array element with things like
for i:=1 to nocharts do
begin
charts.Legend.visible:=true;//false;
charts.MarginRight:=200;
charts.Marginleft:=0;
end;
My question is, is this a good way to do this,
and do I need to have the following in the forms onclose event.
for i:=1 to nocharts do
begin
charts.Free;
end;
type
Tmyfrm = class(TForm)
.
.
private
mycharts:array[1..32] of tchart;
procedure Tmyfrm.create(sender:TObject);
var
i:nteger;
begin
for i:=1 to chartcount do
charts:=Tchart.create(self);
charts[1]:=chart1;
charts[2]:=chart2
etc
end;
Can the access charts by array element with things like
for i:=1 to nocharts do
begin
charts.Legend.visible:=true;//false;
charts.MarginRight:=200;
charts.Marginleft:=0;
end;
My question is, is this a good way to do this,
and do I need to have the following in the forms onclose event.
for i:=1 to nocharts do
begin
charts.Free;
end;