Show X axis in seconds or minutes or hours?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jun 29, 2007 11:44 am

Hi Dominik,

Yes, but we are pretty busy at the moment and we need some time to review it. We will post a reply ASAP.

Thanks for your patience.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Fri Jun 29, 2007 11:52 am

Hi Narcis,

sounds fantastic !

I have to write some other stuff. So it is not so important for within the net days. It would be great if you have some info for me at the end of the next week.

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Fri Jul 06, 2007 9:09 am

Hi Narcis,

do you think that there will be a solution this week ?

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Wed Jul 11, 2007 12:36 pm

Hi Narcis,

we actually implement TChart as our new charting engine. Do you have any idea when you will have the solution for this time axis problem?

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jul 11, 2007 3:14 pm

Hi Dominik,

using the following code in your demo app. works fine here :

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
const second=1/(24*3600); //Fractional number representing one second in TDateTime
Var i: Integer;
begin
  Series1.XValues.DateTime          := True;

  With Chart1.BottomAxis do
  begin
    Increment:=DateTimeStep[dtOneSecond];
    DateTimeFormat := ComboBox1.Text;//'hh:mm:ss';
    RoundFirstLabel:=False;
  end;

  Chart1.Series[0].Clear;
  Chart1.Series[1].Clear;
  For i := 0 to 1336 do begin
    Chart1.Series[0].AddXY(Values[i, 1] * second, Values[i, 2]);
    Chart1.Series[1].AddXY(Values[i, 1] * second, Values[i, 3]);
  end;
end;
Does it works fine for you ?

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Wed Jul 11, 2007 3:28 pm

Hi Pep !

Thx for the reply !

Well ... It works if you use hh:mm:ss. If you try mm:ss I see only 12:57 ...

But maybe there is another way ..

If I use hh:mm:ss I get the following x strings:
00:00:27, 00:00:57, 00:01:27, .....

Is it possible to kill all unimportant zeros? So the result should be something like this:
27, 57, 1:27, ....

And in addition ... If I kill the zeros, would it be also possible to write the strings like this:
27s, 57s, 1m27s, ....

And as the last question ...
How can I enhance the output to dd:hh:mm:ss ? It could be possible that customers produce very large logs.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Jul 12, 2007 11:32 am

Hi Dominik,
Well ... It works if you use hh:mm:ss. If you try mm:ss I see only 12:57 ...
So, if I understand is correct for you ?
Is it possible to kill all unimportant zeros? So the result should be something like this:
27, 57, 1:27, ....
Not with formatted datetime string, that I know. I think the smallest DateTimeFormat would be to use :
DateTimeFormat := 'h:m:s';
This will remove the one character if it's not required for example 01:02:03 will change to 1:2:3.
One way to accomplish it would be to use the OnGetAxisLabel event and there customize the labels, removing the 0, etc..
And in addition ... If I kill the zeros, would it be also possible to write the strings like this:
27s, 57s, 1m27s, ....
The best way, as in the above question is to use the OnGetAxisLabel event to add extra chars.
And as the last question ...
How can I enhance the output to dd:hh:mm:ss ? It could be possible that customers produce very large logs.
I'm sorry, I'm not sure what you refer here, could you please be more specific ?

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Thu Jul 12, 2007 7:40 pm

Hi Pep,
OnGetAxisLabel
That´s exactly what I need.
I will add code like this:

Code: Select all

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  If Sender = Chart1.BottomAxis Then
    if copy(LabelText, 1, 2) = '00' then
      LabelText := Copy(LabelText, 4, length(LabelText));
end;
I'm sorry, I'm not sure what you refer here, could you please be more specific ?
Of course :)

Actually I use this DateTimeFormat : hh:mm:ss
This means you have hours:minutes:Seconds

Is there a possibility to use the datetimeformat like this: dd:hh:mm:ss
Which means days:hours:minutes:seconds

Or a datetimeformat like this: hh:mm:ss:ms
Which means hours:minutes:seconds:milliseconds

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jul 13, 2007 8:19 am

Hi Dominik,
Is there a possibility to use the datetimeformat like this: dd:hh:mm:ss
Which means days:hours:minutes:seconds
Yes, setting :

DateTimeFormat := 'dd:hh:mm:ss';

This will display day:hour:mm:ss. Maybe you need num. of days ? In that case it should be added manually.
Or a datetimeformat like this: hh:mm:ss:ms
Which means hours:minutes:seconds:milliseconds
Yes, you can display milliseconds setting :

DateTimeFormat := 'hh:mm:ss:zzz';

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Fri Jul 13, 2007 8:47 am

Hi Pep,
Maybe you need num. of days ? In that case it should be added manually.
How can I add this manually? Do you have a small example?

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jul 13, 2007 9:04 am

Hi Dominik,

as other things you commented, by using the OnGetAxisLabel event.

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Fri Jul 13, 2007 9:08 am

Hi Pep,

Ok. Thx for your help !

Post Reply