Problem with a series created at runtime.


2007-05-22 01:57:13 PM
delphi54
It seems simple enough, but I just can not figure out what I am doing
wrong. I am hoping that if I do, with help obviously, I will be able to
figure out why me legends are messes up when I print the chart
(created at runtime, properties and values assigned, etc.)
When I create a series in the editor, this code works fine:
var Series1.TBarSeries;
.
with Series1 do
begin
Name:='Series1';
HorizAxis:=aBottomAxis;
VertAxis:=aLeftAxis;
Marks.Visible:=false;
Dark3D:=true;
BarStyle:=bsRectGradient;
BarWidthPercent:=80;
RefreshSeries;
end;
But the progam will not complie with this code:
Chart1.AddSeries(TBarSeries.Create(Form1));
with Chart1.Series[LapsChart.SeriesCount-1] do
begin
Name:='Series'+IntToStr(LapsChart.SeriesCount-1);
HorizAxis:=aBottomAxis;
VertAxis:=aLeftAxis;
Marks.Visible:=false;
//OK so far, but for the following lines:
Dark3D:=true;
BarStyle:=bsRectGradient;
BarWidthPercent:=80;
//I get "undeclared identifier" errors. Then the rest is OK.
RefreshSeries;
end;