Tchart画线形图时怎么让横坐标显示固定的值???(50分)

  • 主题发起人 主题发起人 青梅
  • 开始时间 开始时间

青梅

Unregistered / Unconfirmed
GUEST, unregistred user!
现在我要把一些sqlserver2000中的一些历史记录用曲线图表示出来,可是由于记录的时间间隔不是固定的所以横坐标显示的很不均匀,我想怎么才能让横坐标显示的比较均匀?
例如我的记录是这样:

2003-12-6 12:30:25 26
2003-12-6 12:35:25 30
2003-12-6 12:38:25 28
2003-12-6 12:41:25 23
2003-12-6 12:49:25 20
2003-12-6 12:50:25 20
。。。
我现在是取一条记录就把它画要chart上,可是这样看的话就好像宽窄不一,很不好看,能不能有一种办法,比如只让横坐标显示5/10分,而记录的点画到曲线上,不让该记录点显示横坐标。有没有什么办法??

就是看起来横坐标只有如下:
12:30 12:35 12:40 12:45 12:50 。。。。

现在我的代码如下(有没有什么办法可以实现我上面说的):

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;







 
怎么没有理俺////
 
后退
顶部