TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
Messie
- Newbie

- Posts: 34
- Joined: Wed Apr 13, 2005 4:00 am
- Location: Goettingen, Germany
Post
by Messie » Tue Nov 27, 2007 1:53 pm
Hi,
I need to display a DateTime axis where the labes show hours and minutes.
I found no way to display e.g. 26h as 26:00. Is there any workaround for that? I would accept to get 1d 2h 0m, but the calculation always starts at the 30. (december 1899) so I get 31:02:00.
I already have caught the data in the OnGetAxisLabel Event and tried to use global variables to change the LabelText. This did not work because I can't see any system in the order of the incoming values.
Would be fine to fix that.
Thanks, Messie
TeeChart Pro 7.07 w/o code

-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Wed Dec 05, 2007 11:05 am
Hi Messie,
If we understand well, you would like to start a timer when your application starts and add your points with date relative to this start or relative to one known date. So, you could subtract the initial date from the date at the moment of the point addition to obtain the relative date.
-
PascalKlaus
- Newbie

- Posts: 7
- Joined: Thu Oct 18, 2007 12:00 am
Post
by PascalKlaus » Tue Dec 11, 2007 2:43 pm
This is a formatting problem. 36 h are 1.5 in datetime format. If you format this with FormatDateTime('dd - hh:nn',1.5) it will Return 31 - 12:00
(31 from 31.12.1899 (thats day 1))
use this instead of FormatDateTime:
Code: Select all
function GetTimeDiffStr(dTimeDiff:TDateTime):string;
var
sDays:string;
begin
if Abs(dTimeDiff) >= 1
then sDays := IntToStr(trunc(Abs(dTimeDiff))) + ' - '
else sDays := '';
Result := sDays + FormatDateTime('hh:nn:ss',Abs(dTimeDiff));
end;
GetTimeDiffStr(1.5)
and you will get "1 - 12:00"