关于TeeChart滚动显示实时数据趋势,但是到了0:00往后就不滚动记录了,为什么?
我的代码:
void __fastcall TForm1::FormCreate(TObject *Sender)
{
TDateTime T;
Word T_h,T_m,T_s,T_ms,temp;
DecodeTime(T.CurrentTime(),T_h,T_m,T_s,T_ms);
if(T_h==0)
{temp=23;}
else
{temp=T_h-1;}
for(int i=0;i<60;i++)
{
for(int j=0;j<60;j=j+5)
{
Series1->AddXY(EncodeTime(temp,T_m,j,0),0);
}
T_m++;
if(T_m==60){temp++;T_m=0;}
if(temp==24){temp=0;}
}
//Series1->FillSampleValues(20); */
}
//---------------------------------------------------------------------------
void TForm1::AddPoint(TChartSeries* Series,float y)
{
double t;
t=Time();
Series->AddXY(t,y);
t=t+EncodeTime(0,0,5,0);
if(Series->Count()>720)
{Series->Delete(0); }// <-- remove the first point
}
//------------------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
AddPoint(Series1,random(100));
}