Delphi中DBChart的应用

Delphi中DBChart的应用:

1.绑定数据
ADOQuery1.Active:=True;
DBChart1.Series[0].DataSource:=ADOQuery1;
DBChart1.Series[0].XLabelSource:='FiledName';
DBChart1.Series[0].YValues.ValueSource:='FieldName';

2.切换图表类型
tmpChart:=DBChart1.Series[0];
ChangeSeriesType(tmp,TLineSeries);
tmpChart.Active:=True;
tmpChart.RefreshSeries;

3.设置分页
DBChart1.ScaleLastPage:=true;
DBChart1.MaxPointsPerPage:=10;
DBChart1.Page:=1;
DBChart1.PreviousPage;
DBChart1.NextPage;
DBChart1.Page:=NumPages;

4.导出图表
SaveToBitmapFile(FileName);

5.打印图表
uses TeePrevi;
ChartPreview(Parent,DBChart1);
TeePreview(Parent,DBChart1);

6.数据源
ADODataSet1.CreateDataSet;
AdoDataSet1.Insert;
AdoDataSet1.FieldByName('Value').AsFloat:=200000;
AdoDataSet1.FieldByName('Info').AsString:='05-02';
AdoDataSet1.Post;

你可能感兴趣的:(Delphi,Tdbchart应用)