F fsxy Unregistered / Unconfirmed GUEST, unregistred user! 2004-05-31 #1 请问各位大虾 我想通过按钮把一个条形统计图 变成一个饼形的或是线性的。 该怎么做呢? 在下线等!!!!!
J Jandy89 Unregistered / Unconfirmed GUEST, unregistred user! 2004-05-31 #3 我在离线包找到的 你看看可以吗? procedure TFrmCust_New.ComboBox1Change(Sender: TObject); var mybar:Tbarseries;//柱形图 mypie:Tpieseries;//饼图 myline:Tlineseries;//折线图 begin case combobox1.ItemIndex of 0: begin dbchart1.SeriesList.Clear; mybar:= TBarSeries.Create(self); mybar.ParentChart:=dbchart1; mybar.DataSource:=dmb.Qr_AncustNewS; mybar.XLabelsSource :='Create_date'; mybar.YValues.ValueSource:='总记录数'; end; 1: begin dbchart1.SeriesList.Clear; mypie:= TpieSeries.Create(self); mypie.ParentChart:=dbchart1; mypie.DataSource:=dmb.Qr_AncustNewS; mypie.XLabelsSource :='Create_date'; mypie.YValues.ValueSource:='总记录数'; end; 2: begin dbchart1.SeriesList.Clear; myLine:= TLineSeries.Create(self); myLine.ParentChart:=dbchart1; myLine.DataSource:=dmb.Qr_AncustNewS; myLine.XLabelsSource :='Create_date'; myLine.YValues.ValueSource:='总记录数'; end; end; end;
我在离线包找到的 你看看可以吗? procedure TFrmCust_New.ComboBox1Change(Sender: TObject); var mybar:Tbarseries;//柱形图 mypie:Tpieseries;//饼图 myline:Tlineseries;//折线图 begin case combobox1.ItemIndex of 0: begin dbchart1.SeriesList.Clear; mybar:= TBarSeries.Create(self); mybar.ParentChart:=dbchart1; mybar.DataSource:=dmb.Qr_AncustNewS; mybar.XLabelsSource :='Create_date'; mybar.YValues.ValueSource:='总记录数'; end; 1: begin dbchart1.SeriesList.Clear; mypie:= TpieSeries.Create(self); mypie.ParentChart:=dbchart1; mypie.DataSource:=dmb.Qr_AncustNewS; mypie.XLabelsSource :='Create_date'; mypie.YValues.ValueSource:='总记录数'; end; 2: begin dbchart1.SeriesList.Clear; myLine:= TLineSeries.Create(self); myLine.ParentChart:=dbchart1; myLine.DataSource:=dmb.Qr_AncustNewS; myLine.XLabelsSource :='Create_date'; myLine.YValues.ValueSource:='总记录数'; end; end; end;
P protossgffnxk Unregistered / Unconfirmed GUEST, unregistred user! 2004-06-02 #4 var tmpSeries:TChartSeries; ..... tmpSeries := DBChart1.Series[0]; ChangeSeriesType(tmpSeries,TChartSeriesClass(TpieSeries));//变为饼图: //ChangeSeriesType(tmpSeries,TChartSeriesClass(TBarSeries));//变为条图 ..................
var tmpSeries:TChartSeries; ..... tmpSeries := DBChart1.Series[0]; ChangeSeriesType(tmpSeries,TChartSeriesClass(TpieSeries));//变为饼图: //ChangeSeriesType(tmpSeries,TChartSeriesClass(TBarSeries));//变为条图 ..................