我正在使用TDBChart显示3个数据库。你能指出一个向每个bareries添加趋势线的好例子吗? TeeChart下载附带的示例完全没有帮助。
由于
答案 0 :(得分:1)
这里有一个简单的例子,用随机值创建3个TBarSeries,然后创建3个TTrendFunction(及其各自的TLineSeries):
uses Series, CurvFitt;
procedure TForm1.FormCreate(Sender: TObject);
var
tmpBar:TBarSeries;
tmpTrend:TTrendFunction;
tmpLine: TLineSeries;
i, nSeries: Integer;
begin
Chart1.Legend.Visible:=false;
Chart1.View3D:=false;
for i:=0 to 2 do
begin
tmpBar:=Chart1.AddSeries(TBarSeries) as TBarSeries;
with tmpBar do
begin
Marks.Visible:=false;
FillSampleValues;
end;
end;
nSeries:=Chart1.SeriesCount;
for i:=0 to nSeries-1 do
begin
tmpBar:=Chart1[i] as TBarSeries;
tmpTrend:=TTrendFunction.Create(Self);
tmpTrend.Period:=3;
tmpLine:=Chart1.AddSeries(TLineSeries) as TLineSeries;
with tmpLine do
begin
Color:=tmpBar.Color;
SetFunction(tmpTrend);
DataSource:=tmpBar;
end;
end;
end;