Page 1 of 1

Re: Date time label shift ?

Posted: Mon Jan 22, 2007 6:15 am
by 9043243
Hi,

I am new to TeeChart and have questions related to time axis(bottomaxis) control. I have a job to plot a real-time data, the data arrives at every 10 seconds, so it is not very fast data.

My question is how to implement following chart:
(1) I want the chart only display one hour length of data, for example, if current time is 16:00:00, then the left end of axis should be 15:00:00, and the right end should be 16:00:00.

(2) The latest data always be plotted on the very right side, for example, if current time is 16:00:10 and the data arrives, then the time (bottom) axis label at right end side will change to 16:00:10 and left end side is 15:00:10, in other words, the chart shifts left 10 seconds.

(3) The very first data should be plotted at the left end side of bottom, for example, if program starts from 15:00:00. then the 15:00:00 data should be plotted at the left end side of bottom axis, and the chart will plot from left end to right end. Once time is over 16:00:00, then chart starts shift every time when a data arrives.

Can you tell me how to implement this ?

At the moment, the configuration for date time axis (bottom axis) is automatic, so when it starts, the date time axis has no other date time labels except at the middle of the axis, there is a default date time which is 20/12/1899 00:00:00,This default time will stay there until the first data comes in. I don't want it, How do I get rid of it ?

Thanks

Daniel

Posted: Mon Jan 22, 2007 8:19 am
by narcis
Hi Daniel,

Please read this article on how to use TeeChart in real-time applications.
At the moment, the configuration for date time axis (bottom axis) is automatic, so when it starts, the date time axis has no other date time labels except at the middle of the axis, there is a default date time which is 20/12/1899 00:00:00,This default time will stay there until the first data comes in. I don't want it, How do I get rid of it ?


You can try setting minimum and maximum values for the bottom axis before populating the series and then set it back to automatic:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.XValues.DateTime:=true;
  Chart1.Axes.Bottom.SetMinMax(now,now);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Chart1.Axes.Bottom.Automatic:=true;
  Series1.FillSampleValues();
end;