procedure TChartFrm.Button1Click(Sender: TObject); var myseries:array of TBarSeries; i:integer; begin setlength(myseries,Lanstart.DBGrid1.Columns.Count); DBChart1.View3D:=false; DBChart1.FreeAllSeries; For i:=0 to Lanstart.DBGrid1.Columns.Count-1 do begin myseries[i]:= TBarSeries.Create(self); With myseries[i] do begin ParentChart := DBChart1; marks.Style:= smsvalue; DataSource := dataset.ADOQuery2; if i=0 then XLabelsSource := Lanstart.DBGrid1.Columns[i].FieldName else begin XLabelsSource := Lanstart.DBGrid1.Columns[0].FieldName; YValues.ValueSource := Lanstart.DBGrid1.Columns[i].FieldName; end; end; //CheckDatasource; end; end; |