iocomp的iplot如何使得日期正确?
我使用了iplot,x轴的数据来自数据库,现在的问题是:显示的日期时间根本不对。
代码如下:
iPlot1.XAxis[0].Title:=Trim(XComboBox.Text); // X轴名称
iPlot1.XAxis[0].TitleFont.color:=myC;
iPlot1.XAxis[0].TitleShow:=True;
iPlot1.XAxis[0].LabelsFormatStyle := iptfDateTime;
iPlot1.XAxis[0].DateTimeFormat := 'yyyy/mm/dd hh:nn:ss';
//iPlot1.XAxis[Channel_Count].Span := 10; // X轴显示范围
iPlot1.Channel[0].XAxisName := Trim(XComboBox.Text);//iPlot1.XAxis[0].Name;
iPlot1.XAxis[0].LabelsFont.Color := myC; // 标签字体颜色
iPlot1.XAxis[0].TitleShow:=True;
FreeAndNil(myTbl);
mytbl:=DataMForm.CreatetmpSQLTable(Self.name+'my_wavetbl',
'SELECT * FROM EXPERIMDATA WHERE (RECDATE is not NULL) and (EXP_MC='''+DTUComboBox.text+''') and (EXP_LX='''+CMDComboBox.text+''') ORDER BY '+ X_field+' ASC');
mytbl.Active:=True;
with mytbl do begin
First;
while not Eof do begin
iPlot1.Channel[Channel_Count].AddXY(FieldByName(X_field).Value,FieldbyName(Y_field).Value); // 跟随绘制0刻度线
Next;
end;
end;
还有一个问题,如何让 显示的曲线 就在采集的内容附近?
谢谢
[解决办法]
呵呵,还提供源码,不太可能吧。这么好?
[解决办法]
ACCESS的日期时间和DELPHI的日期时间是不一样的,要转换下,VarToDateTime(FieldValues['日期时间字段'])或者FieldByName('日期时间字段').AsDateTime