procedure TForm1.Button1Click(Sender: TObject);
var
ssql : string;
begin
with Unit1.Form1.ADOQuery2 do
begin
close;
SQL.clear;
ssql:=' SELECT Temperature, Humidity,'
+' Sampling_Date+'+#39+ ' '+#39 +'+Sampling_Time AS DateTime,'
+' Wind_Speed, Vane, Sampling_Date, Sampling_Time'
+' FROM Ice_WatchInfo ';
SQL.add(ssql);
Open;
MaxPointsPerPage:=24;
end;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
ShowSeries(0,CheckBox1.Checked);
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
ShowSeries(1,CheckBox2.Checked);
end;
procedure TForm1.ShowSeries(Const Index:Integer;Visible:Boolean);
begin
DBChart.Series[Index].Active:=Visible;
//DBChart1.Series[Index].Active:=Visible;
end;
procedure TForm1.DBChartPageChange(Sender: TObject);
begin
DBChart.UndoZoom;
if DBChart.Foot.Text.Count>0 then
begin
DBChart.Foot.Text[DBChart.Foot.Text.Count-1]:='第'+IntToStr(DBChart.Page)
+'页共'+IntToStr(DBChart.NumPages)+'页';
end else
DBChart.Foot.Text.Add('第'+IntToStr(DBChart.Page)
+'页共'+IntToStr(DBChart.NumPages)+'页');
actFirstPage.Enabled:=DBChart.Page > 1;
actNextPage.Enabled:=DBChart.Page < DBChart.NumPages;
actLastPage.Enabled:=actNextPage.Enabled;
actPriorPage.Enabled:= actFirstPage.Enabled;
end;
procedure TForm1.RzToolButton2Click(Sender: TObject);
begin
DBChart.NextPage;
end;
procedure TForm1.tbtnFirstPageClick(Sender: TObject);
begin
DBChart.Page:=1;
end;
procedure TForm1.tbtnPriorPageClick(Sender: TObject);
begin
DBChart.PreviousPage;
end;
procedure TForm1.tbtnNextPageClick(Sender: TObject);
begin
DBChart.NextPage;
end;
procedure TForm1.tbtnlastPageClick(Sender: TObject);
begin
DBChart.Page:=DBChart.NumPages;
end;
function TForm1.GetMaxPointsPerPage: Integer;
begin
Result:=DBChart.MaxPointsPerPage;
end;
procedure TForm1.SetMaxPointsPerPage(Value: Integer);
begin
DBChart.MaxPointsPerPage:=Value;
DBChartPageChange(nil);
end;
end.
这是主要代码