I can't seem to find an answer to what I hope is a simple problem
I have a chart with 3 series
I have three Arrays[0..255] each holding data points for the plot
I want to move (scroll) the chart contents over time by removing the oldest, moving others down, and with the latest value added at high(Myarray) (essentially First In First out)
All of the above works, but I want to plot these arrays but with a timestamp on the horizontal axis showing the time points
To show the moving chart, I am using
Chart1.Series[0].Clear;
Chart1.Series[0].AddArray(MyArray1);
What do I have to do to show a timestamp on the horizontal axis for each recorded point in the array?
Many thanks
Showing timestamp on Horizontal axis with AddArray
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Showing timestamp on Horizontal axis with AddArray
Hi Track1,
For that you just need to set DateTime property to true in your series, for example:
Hope this helps!
For that you just need to set DateTime property to true in your series, for example:
Code: Select all
Chart1.Series[0].XValues.DateTime:=True;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Showing timestamp on Horizontal axis with AddArray
Re:
Chart1.Series[0].XValues.DateTime:=True;
Thanks Narcis, but I already tried that, still there is only zero on the H axis:
IdleProcessingTimeArray : Array[0..255] of Double;
SocketProcessingTimeArray : Array[0..255] of Double;
XformProcessingTimeArray : Array[0..255] of Double;
...
chart1.Series[0].Clear;
chart1.Series[1].Clear;
chart1.Series[2].Clear;
chart1.Series[0].XValues.DateTime := True;
Chart1.BottomAxis.DateTimeFormat := 'hh:mm:ss' ;
chart1.Series[0].ADDArray(SocketProcessingTimeArray);
chart1.Series[1].AddArray(XformProcessingTimeArray);
chart1.Series[2].AddArray(IdleProcessingTimeArray);
Many thanks for any suggestions
Chart1.Series[0].XValues.DateTime:=True;
Thanks Narcis, but I already tried that, still there is only zero on the H axis:
IdleProcessingTimeArray : Array[0..255] of Double;
SocketProcessingTimeArray : Array[0..255] of Double;
XformProcessingTimeArray : Array[0..255] of Double;
...
chart1.Series[0].Clear;
chart1.Series[1].Clear;
chart1.Series[2].Clear;
chart1.Series[0].XValues.DateTime := True;
Chart1.BottomAxis.DateTimeFormat := 'hh:mm:ss' ;
chart1.Series[0].ADDArray(SocketProcessingTimeArray);
chart1.Series[1].AddArray(XformProcessingTimeArray);
chart1.Series[2].AddArray(IdleProcessingTimeArray);
Many thanks for any suggestions
- Attachments
-
- 10-06-2010 6-30-22 PM.png (26.32 KiB) Viewed 9352 times
-
- 10-06-2010 6-19-45 PM.png (7.13 KiB) Viewed 9344 times
Re: Showing timestamp on Horizontal axis with AddArray
Hi Track1,
That's normal because you have Integers as DateTime in the XValues and you are formatting them as 'hh:mm'. Let me explain:
There are two AddArray methods available. Here there are their definitions:
As you are using the first one, only adding the YValues, the XValues are 0, 1, 2, 3,... and translating them to DateTime, it's "30/12/1899 00:00:00" for the 0, "31/12/1899 00:00:00" for the 1,...
And formatting these DateTimes to 'hh:mm', you always get "00:00".
So I'd recommend you to use the second AddArray method.
That's normal because you have Integers as DateTime in the XValues and you are formatting them as 'hh:mm'. Let me explain:
There are two AddArray methods available. Here there are their definitions:
Code: Select all
Function AddArray(Const Values:Array of TChartValue):Integer; overload;
Function AddArray(Const XValues, YValues:Array of TChartValue):Integer; overload;
And formatting these DateTimes to 'hh:mm', you always get "00:00".
So I'd recommend you to use the second AddArray method.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Showing timestamp on Horizontal axis with AddArray
Thank you Yeeray, but still the problem exists
I am now using the overload method
RecAtTimeArray : Array[0..255] of Double; // (stores 'Now')
IdleProcessTimeArray : Array[0..255] of Double;
...
//move other values down like before then add new value:
//Each time I update the array I add the date time as well in the second array
RecAtTime(high(recAtTime)) := Now;
IdleProcessTimeArray(high(IdleProcessTimeArray)) := IdleProcessTime;
Chart1.Series[0].Clear;
Chart1.Series[0].AddArray(RecATTimeArray, IdleProcessTimeArray);
I think the system adds multiple time stamps (255 of them) for each and every IdleProcessTimeArray array point
Result shown. Many thanks for your support
I am now using the overload method
RecAtTimeArray : Array[0..255] of Double; // (stores 'Now')
IdleProcessTimeArray : Array[0..255] of Double;
...
//move other values down like before then add new value:
//Each time I update the array I add the date time as well in the second array
RecAtTime(high(recAtTime)) := Now;
IdleProcessTimeArray(high(IdleProcessTimeArray)) := IdleProcessTime;
Chart1.Series[0].Clear;
Chart1.Series[0].AddArray(RecATTimeArray, IdleProcessTimeArray);
I think the system adds multiple time stamps (255 of them) for each and every IdleProcessTimeArray array point
Result shown. Many thanks for your support
- Attachments
-
- 10-06-2010 7-52-01 PM.png (9.52 KiB) Viewed 9342 times
Re: Showing timestamp on Horizontal axis with AddArray
Any idea anybody how to show a graph and place my own time values for each point on the horizontal axis?
Re: Showing timestamp on Horizontal axis with AddArray
OK, I worked it out
I must user the overloaded method for every series I add to the chart
Series1.AddArray(RecTimeArray, MyData1Array);
Series2.AddArray(RecTimeArray, MyData2Array);
Series3.AddArray(RecTimeArray, MyData2Array);
Adding any series, (not just the one set for XValues.DateTime := True), without adding both arrays, regardless of the order they are added (first, last etc), stops the time display working (shows all zero's).
Regards
I must user the overloaded method for every series I add to the chart
Series1.AddArray(RecTimeArray, MyData1Array);
Series2.AddArray(RecTimeArray, MyData2Array);
Series3.AddArray(RecTimeArray, MyData2Array);
Adding any series, (not just the one set for XValues.DateTime := True), without adding both arrays, regardless of the order they are added (first, last etc), stops the time display working (shows all zero's).
Regards
Re: Showing timestamp on Horizontal axis with AddArray
Hi,
I'm glad to see you've found how to do it.
I'm glad to see you've found how to do it.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |