现在我在Tchart中画了三条线,我设置第一条线是clred第二、三条是clgreen,可是好像没用,Tchart总是第一条是红的,第二条是绿的,第三条是黄的。
代码如下:var
myseries1t,myseries1h:TFastLineSeries;
myseriesti,myserieshi,myseriesta,myseriesha:TFastLineSeries;
dt:Tdatetime;
t1,h1{,t2,h2,t3,h3},sdt:string;
begin
ADOQuery1.Active :=false;
//chart1温度标题
chart1.Title.Text.Clear ;
chart1.Title.Text.Add('温度曲线图'+jfname); //
chart1.SeriesList.Clear; //chart2湿度标题
chart2.Title.Text.Clear ;
chart2.Title.Text.Add('湿度曲线图'+jfname); //
chart2.SeriesList.Clear; //设置温度最小正常值曲线
myseriesti:= TFastLineSeries.Create(self);
myseriesti.ParentChart:=chart1;
myseriesti.Title :='温度最小'; //温度记录值
if CheckBox1.Checked then
begin
myseries1t:= TFastLineSeries.Create(self);
myseries1t.ParentChart:=chart1;
myseries1t.Title :='温度';
end; //设置温度最大正常值曲线
myseriesta:= TFastLineSeries.Create(self);
myseriesta.ParentChart:=chart1;
myseriesta.Title :='温度最大'; //设置湿度最小正常值曲线
myserieshi:= TFastLineSeries.Create(self);
myserieshi.ParentChart:=chart2;
myserieshi.Title:='湿度最小'; //湿度记录值
if CheckBox2.Checked then
begin
myseries1h:= TFastLineSeries.Create(self);
myseries1h.ParentChart:=chart2;
myseries1h.Title:='湿度';
end; //设置湿度最小正常值曲线
myseriesha:= TFastLineSeries.Create(self);
myseriesha.ParentChart:=chart2;
myseriesha.Title:='湿度最大'; chart1.LeftAxis.SetMinMax(0,50); //设置纵坐标值的范围(温度)
chart2.LeftAxis.SetMinMax(0,100); //设置纵坐标值的范围(湿度) with ADOQUERY1 do
begin
close;
sql.Clear ;
sql.Add('select jfCT1,jfCH1,jfCT2,jfCH2,jfCT3,jfCH3,evttime from jfCdevtlog order by evttime desc');
open;
ADOQUERY1.Fields.Count; //记录总数 while not eof do
begin
dt:=FieldByName('evttime').AsDateTime;
sdt:=FormatDateTime('YY/MM/DD HH:MM:SS',dt); //
if CheckBox1.Checked then
begin
t1:=FieldByName('jfCT1').AsString ; myseriesti.AddXY(dt,strToFloat('15'),copy(sdt,10,5),clred) ;
myseries1t.AddXY(dt,strToFloat(t1),copy(sdt,10,5),clgreen) ;
myseriesta.AddXY(dt,strToFloat('28'),copy(sdt,10,5),clred) ;
end;
if CheckBox2.Checked then
begin
h1:=FieldByName('jfCH1').AsString ;
myserieshi.AddXY(dt,strToFloat('30'),copy(sdt,10,5),clred );
myseries1h.AddXY(dt,strToFloat(h1),copy(sdt,10,5),clgreen );
myseriesha.AddXY(dt,strToFloat('70'),copy(sdt,10,5),clred );
end;
next;
end;
end;
label1.Caption :='共有:'+IntToStr(chart1.NumPages)+'页 ';
label2.Caption :='当前页:'+IntToStr(chart1.Page)+'页 ' ;
end;
代码如下:var
myseries1t,myseries1h:TFastLineSeries;
myseriesti,myserieshi,myseriesta,myseriesha:TFastLineSeries;
dt:Tdatetime;
t1,h1{,t2,h2,t3,h3},sdt:string;
begin
ADOQuery1.Active :=false;
//chart1温度标题
chart1.Title.Text.Clear ;
chart1.Title.Text.Add('温度曲线图'+jfname); //
chart1.SeriesList.Clear; //chart2湿度标题
chart2.Title.Text.Clear ;
chart2.Title.Text.Add('湿度曲线图'+jfname); //
chart2.SeriesList.Clear; //设置温度最小正常值曲线
myseriesti:= TFastLineSeries.Create(self);
myseriesti.ParentChart:=chart1;
myseriesti.Title :='温度最小'; //温度记录值
if CheckBox1.Checked then
begin
myseries1t:= TFastLineSeries.Create(self);
myseries1t.ParentChart:=chart1;
myseries1t.Title :='温度';
end; //设置温度最大正常值曲线
myseriesta:= TFastLineSeries.Create(self);
myseriesta.ParentChart:=chart1;
myseriesta.Title :='温度最大'; //设置湿度最小正常值曲线
myserieshi:= TFastLineSeries.Create(self);
myserieshi.ParentChart:=chart2;
myserieshi.Title:='湿度最小'; //湿度记录值
if CheckBox2.Checked then
begin
myseries1h:= TFastLineSeries.Create(self);
myseries1h.ParentChart:=chart2;
myseries1h.Title:='湿度';
end; //设置湿度最小正常值曲线
myseriesha:= TFastLineSeries.Create(self);
myseriesha.ParentChart:=chart2;
myseriesha.Title:='湿度最大'; chart1.LeftAxis.SetMinMax(0,50); //设置纵坐标值的范围(温度)
chart2.LeftAxis.SetMinMax(0,100); //设置纵坐标值的范围(湿度) with ADOQUERY1 do
begin
close;
sql.Clear ;
sql.Add('select jfCT1,jfCH1,jfCT2,jfCH2,jfCT3,jfCH3,evttime from jfCdevtlog order by evttime desc');
open;
ADOQUERY1.Fields.Count; //记录总数 while not eof do
begin
dt:=FieldByName('evttime').AsDateTime;
sdt:=FormatDateTime('YY/MM/DD HH:MM:SS',dt); //
if CheckBox1.Checked then
begin
t1:=FieldByName('jfCT1').AsString ; myseriesti.AddXY(dt,strToFloat('15'),copy(sdt,10,5),clred) ;
myseries1t.AddXY(dt,strToFloat(t1),copy(sdt,10,5),clgreen) ;
myseriesta.AddXY(dt,strToFloat('28'),copy(sdt,10,5),clred) ;
end;
if CheckBox2.Checked then
begin
h1:=FieldByName('jfCH1').AsString ;
myserieshi.AddXY(dt,strToFloat('30'),copy(sdt,10,5),clred );
myseries1h.AddXY(dt,strToFloat(h1),copy(sdt,10,5),clgreen );
myseriesha.AddXY(dt,strToFloat('70'),copy(sdt,10,5),clred );
end;
next;
end;
end;
label1.Caption :='共有:'+IntToStr(chart1.NumPages)+'页 ';
label2.Caption :='当前页:'+IntToStr(chart1.Page)+'页 ' ;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货