mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 11:39:19 +02:00
TAChart: TDateTimeIntervalChartSource supports bracket time sympols in FormatDateTime() now (e.g. [h]:nn:ss).
git-svn-id: trunk@62153 -
This commit is contained in:
parent
be4634a30b
commit
6cd0d667be
@ -593,12 +593,23 @@ var
|
||||
helper: TDateTimeIntervalsHelper;
|
||||
prevSt: TSystemTime;
|
||||
|
||||
function DoFormatDateTime(AFormat: String; AValue: TDateTime): String;
|
||||
var
|
||||
optn: TFormatDateTimeOptions;
|
||||
begin
|
||||
if pos('[', AFormat) > 0 then
|
||||
optn := [fdoInterval]
|
||||
else
|
||||
optn := [];
|
||||
Result := FormatDateTime(AFormat, AValue, optn);
|
||||
end;
|
||||
|
||||
function FormatLabel(AValue: TDateTime): String;
|
||||
var
|
||||
st: TSystemTime;
|
||||
begin
|
||||
if DateTimeFormat <> '' then
|
||||
exit(FormatDateTime(DateTimeFormat, AValue));
|
||||
exit(DoFormatDateTime(DateTimeFormat, AValue));
|
||||
DateTimeToSystemTime(AValue, st);
|
||||
case helper.FBestStep of
|
||||
dtsYear:
|
||||
@ -608,30 +619,36 @@ var
|
||||
FormatDateTime(DateTimeStepFormat.YearFormat, AValue);
|
||||
dtsMonth:
|
||||
if FSuppressPrevUnit and (st.Year = prevSt.Year) then
|
||||
Result := FormatDateTime('mm', AValue) else
|
||||
Result := FormatDateTime('mm', AValue)
|
||||
else
|
||||
Result := FormatDateTime(DateTimeStepFormat.MonthFormat, AValue);
|
||||
dtsWeek:
|
||||
Result := FormatDateTime(DateTimeStepFormat.WeekFormat, AValue);
|
||||
dtsDay:
|
||||
if FSuppressPrevUnit and (st.Month = prevSt.Month) then
|
||||
Result := FormatDateTime('dd', AValue) else
|
||||
Result := FormatDateTime(DateTimeStepFormat.DayFormat, AValue);
|
||||
Result := DoFormatDateTime('dd', AValue)
|
||||
else
|
||||
Result := DoFormatDateTime(DateTimeStepFormat.DayFormat, AValue);
|
||||
dtsHour:
|
||||
if FSuppressPrevUnit and (st.Day = prevSt.Day) then
|
||||
Result := FormatDateTime('hh:00', AValue) else
|
||||
Result := FormatDateTime(DateTimeStepFormat.HourFormat, AValue);
|
||||
Result := DoFormatDateTime('hh:00', AValue)
|
||||
else
|
||||
Result := DoFormatDateTime(DateTimeStepFormat.HourFormat, AValue);
|
||||
dtsMinute:
|
||||
if FSuppressPrevUnit and (st.Hour = prevSt.Hour) then
|
||||
Result := FormatDateTime('nn', AValue) else
|
||||
Result := FormatDateTime(DateTimeStepFormat.MinuteFormat, AValue);
|
||||
Result := DoFormatDateTime('nn', AValue)
|
||||
else
|
||||
Result := DoFormatDateTime(DateTimeStepFormat.MinuteFormat, AValue);
|
||||
dtsSecond:
|
||||
if FSuppressPrevUnit and (st.Minute = prevSt.Minute) then
|
||||
Result := FormatDateTime('ss', AValue) else
|
||||
Result := FormatDateTime(DateTimeStepFormat.SecondFormat, AValue);
|
||||
Result := DoFormatDateTime('ss', AValue)
|
||||
else
|
||||
Result := DoFormatDateTime(DateTimeStepFormat.SecondFormat, AValue);
|
||||
dtsMillisecond:
|
||||
if FSuppressPrevUnit and (st.Second = prevSt.Second) then
|
||||
Result := IntToStr(st.Millisecond) + 'ms' else
|
||||
Result := FormatDateTime(DateTimeStepFormat.MillisecondFormat, AValue);
|
||||
Result := IntToStr(st.Millisecond) + 'ms'
|
||||
else
|
||||
Result := DoFormatDateTime(DateTimeStepFormat.MillisecondFormat, AValue);
|
||||
end;
|
||||
if InRange(AValue, helper.FOrigParams.FMin, helper.FOrigParams.FMax) then
|
||||
prevSt := st;
|
||||
|
Loading…
Reference in New Issue
Block a user