给你一段例子是动态创建的Series,而且是多个:
procedure TForm_Zdsyfx.Radio_LineClick(Sender: TObject);
var
I:Integer;
Series_AddLine:array of TLineSeries;
begin
if not Table_Dnqsfx.Active then
Exit;
DBChart3.FreeAllSeries;
SetLength(Series_AddLine,Table_Dnqsfx.FieldCount-1);
for I:=0 to Table_Dnqsfx.FieldCount-2do
begin
Series_AddLine:=TLineSeries.Create(DBChart3);
with Series_AddLinedo
begin
ParentChart:=DBChart3;
ShowInLegend:=True;
Title:= '2'+Copy(Table_Dnqsfx.Fields[I+1].FieldName,2,3)+'年';
Pointer.Visible:=True ;
DataSource:=Table_Dnqsfx;
XLabelsSource:='Rq';
YValues.ValueSource:=Table_Dnqsfx.Fields[I+1].FieldName;
end;
end;
DBChart3.Repaint;
end;