procedure TForm_SJFX_XSDDFX.ShowChart(itype: integer; Dset: TQuery; xlabel, yvalues: string); var vPie: TPieSeries; vBar: TBarSeries; vLine: TLineSeries; i: integer; begin while DBChart.SeriesCount > 0 do DBChart.SeriesList[0].Destroy; DBChart.Title.Text.Clear; DBChart.Title.Text.Add(ChartTitle); DBChart.LeftAxis.Title.Caption := yvalues; DBChart.BottomAxis.Title.Caption := xlabel; // if itype = 0 then begin vBar := TBarSeries.Create(nil); vBar.ParentChart := DBChart; vBar.DataSource := Dset; vBar.YValues.ValueSource := yvalues; vBar.XLabelsSource := xlabel; vBar.Marks.Style := smsValue; DBChart.AddSeries(vBar); end else if itype = 2 then begin vPie := TPieSeries.Create(nil); vPie.ParentChart := DBChart; vPie.DataSource := Dset; vPie.YValues.ValueSource := yvalues; vPie.XLabelsSource := xlabel; vPie.Marks.Style := smsLabelPercent; DBChart.AddSeries(vPie); end else begin vLine := TLineSeries.Create(nil); vLine.ParentChart := DBChart; vLine.DataSource := Dset; vLine.YValues.ValueSource := yvalues; vLine.XLabelsSource := xlabel; vLine.Marks.Style := smsLabelPercent; DBChart.AddSeries(vLine); end;