mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 20:34:01 +02:00
TAChart: Accept date/time strings in TListChartSource.DataPoints
git-svn-id: trunk@56940 -
This commit is contained in:
parent
3d107d6533
commit
2a5154bef1
@ -351,6 +351,8 @@ function Split(
|
||||
|
||||
// Accept both locale-specific and default decimal separators.
|
||||
function StrToFloatDefSep(const AStr: String): Double;
|
||||
// .. or date/time values
|
||||
function StrToFloatOrDateTimeDef(const AStr: String): Double;
|
||||
|
||||
// Call this to silence 'parameter is unused' hint
|
||||
procedure Unused(const A1);
|
||||
@ -532,6 +534,16 @@ begin
|
||||
Result := 0.0;
|
||||
end;
|
||||
|
||||
function StrToFloatOrDateTimeDef(const AStr: String): Double;
|
||||
begin
|
||||
if
|
||||
not TryStrToFloat(AStr, Result, DefSeparatorSettings) and
|
||||
not TryStrToFloat(AStr, Result) and
|
||||
not TryStrToDateTime(AStr, Result)
|
||||
then
|
||||
Result := 0.0;
|
||||
end;
|
||||
|
||||
{$PUSH}{$HINTS OFF}
|
||||
procedure Unused(const A1);
|
||||
begin
|
||||
|
@ -334,17 +334,18 @@ var
|
||||
|
||||
var
|
||||
i: Integer;
|
||||
s: String;
|
||||
begin
|
||||
parts := Split(AString);
|
||||
try
|
||||
if FSource.YCount + 3 < Cardinal(parts.Count) then
|
||||
FSource.YCount := parts.Count - 3;
|
||||
with ADataItem^ do begin
|
||||
X := StrToFloatDefSep(NextPart);
|
||||
X := StrToFloatOrDateTimeDef(NextPart);
|
||||
if FSource.YCount > 0 then begin
|
||||
Y := StrToFloatDefSep(NextPart);
|
||||
Y := StrToFloatOrDateTimeDef(NextPart);
|
||||
for i := 0 to High(YList) do
|
||||
YList[i] := StrToFloatDefSep(NextPart);
|
||||
YList[i] := StrToFloatOrDateTimeDef(NextPart);
|
||||
end;
|
||||
Color := StrToIntDef(NextPart, clTAColor);
|
||||
Text := NextPart;
|
||||
|
Loading…
Reference in New Issue
Block a user