ClearSeries; if Not ADOQuery.Active then Exit; if LineRadioButton.Checked then //线型图 begin LineSeries := TLineSeries.Create(Self); with LineSeries do begin ParentChart := DBChart; DataSource := ADOQuery; XLabelsSource := ADOQuery.Fields[0].FieldName; YValues.ValueSource := ADOQuery.Fields[1].FieldName; Active := True; Font.Name := '宋体'; Font.Size := 9; end; end else if BarRadioButton.Checked then //柱形图 begin BarSeries := TBarSeries.Create(Self); with BarSeries do begin ParentChart := DBChart; DataSource := ADOQuery; BarStyle := bsRectGradient; ColorEachPoint := True; XLabelsSource := ADOQuery.Fields[0].FieldName; YValues.ValueSource := ADOQuery.Fields[1].FieldName; Active := True; DBChart.View3DOptions.Orthogonal := True; Font.Name := '宋体'; Font.Size := 9; end; end else begin PieSeries := TPieSeries.Create(Self); with PieSeries do //饼形图 begin ParentChart := DBChart; DataSource := ADOQuery; XLabelsSource := ADOQuery.Fields[0].FieldName; PieValues.ValueSource := ADOQuery.Fields[1].FieldName; Active := True; Font.Name := '宋体'; Font.Size := 9; end; end;
ClearSeries;
if Not ADOQuery.Active then Exit;
if LineRadioButton.Checked then //线型图
begin
LineSeries := TLineSeries.Create(Self);
with LineSeries do
begin
ParentChart := DBChart;
DataSource := ADOQuery;
XLabelsSource := ADOQuery.Fields[0].FieldName;
YValues.ValueSource := ADOQuery.Fields[1].FieldName;
Active := True;
Font.Name := '宋体';
Font.Size := 9;
end;
end else
if BarRadioButton.Checked then //柱形图
begin
BarSeries := TBarSeries.Create(Self);
with BarSeries do
begin
ParentChart := DBChart;
DataSource := ADOQuery;
BarStyle := bsRectGradient;
ColorEachPoint := True;
XLabelsSource := ADOQuery.Fields[0].FieldName;
YValues.ValueSource := ADOQuery.Fields[1].FieldName;
Active := True;
DBChart.View3DOptions.Orthogonal := True;
Font.Name := '宋体';
Font.Size := 9;
end;
end else
begin
PieSeries := TPieSeries.Create(Self);
with PieSeries do //饼形图
begin
ParentChart := DBChart;
DataSource := ADOQuery;
XLabelsSource := ADOQuery.Fields[0].FieldName;
PieValues.ValueSource := ADOQuery.Fields[1].FieldName;
Active := True;
Font.Name := '宋体';
Font.Size := 9;
end;
end;