mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 18:29:21 +02:00
TAChart: Add property DateTimeFormat to TDBChartSource for date/time fields returned as strings.
git-svn-id: trunk@63084 -
This commit is contained in:
parent
35d427d277
commit
bc9d1a87a3
@ -33,6 +33,7 @@ type
|
|||||||
FBookmark: TBookmark;
|
FBookmark: TBookmark;
|
||||||
FCurItem: TChartDataItem;
|
FCurItem: TChartDataItem;
|
||||||
FDataLink: TDataLink;
|
FDataLink: TDataLink;
|
||||||
|
FDateTimeFormat: String;
|
||||||
FFieldColor: String;
|
FFieldColor: String;
|
||||||
FFieldText: String;
|
FFieldText: String;
|
||||||
FFieldX: String;
|
FFieldX: String;
|
||||||
@ -66,6 +67,7 @@ type
|
|||||||
procedure Reset;
|
procedure Reset;
|
||||||
published
|
published
|
||||||
property DataSource: TDataSource read GetDataSource write SetDataSource;
|
property DataSource: TDataSource read GetDataSource write SetDataSource;
|
||||||
|
property DateTimeFormat: String read FDateTimeFormat write FDateTimeFormat;
|
||||||
property FieldColor: String read FFieldColor write SetFieldColor;
|
property FieldColor: String read FFieldColor write SetFieldColor;
|
||||||
property FieldText: String read FFieldText write SetFieldText;
|
property FieldText: String read FFieldText write SetFieldText;
|
||||||
property FieldX: String read FFieldX write SetFieldX;
|
property FieldX: String read FFieldX write SetFieldX;
|
||||||
@ -80,7 +82,7 @@ procedure Register;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, SysUtils, TAMath;
|
Math, SysUtils, DateUtils, TAMath;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -187,8 +189,12 @@ procedure TDbChartSource.DefaultGetItem(var AItem: TChartDataItem);
|
|||||||
if IsNull then
|
if IsNull then
|
||||||
Result := SafeNan
|
Result := SafeNan
|
||||||
else if ADateTime then
|
else if ADateTime then
|
||||||
Result := AsDateTime
|
begin
|
||||||
|
if (DataType = ftString) and (FDateTimeFormat <> '') then
|
||||||
|
Result := ScanDateTime(FDateTimeFormat, AsString)
|
||||||
else
|
else
|
||||||
|
Result := AsDateTime
|
||||||
|
end else
|
||||||
Result := AsFloat;
|
Result := AsFloat;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user