The datapoints editor only accepts numbers in the X and Y columns. Of course, TDate, TTime and TDateTime are numbers internally. The number value of Jan 1 2018 for example is 43101. So, if you want to construct X date values in 1-day intervals starting at Jan 1, you enter the numbers 43101, 43102, 43103, etc. in the X column.
In r56940 I modified the ListChartSource to accept also date/time values in the X and Y columns. You must change to Lazarus trunk to get this feature. Or you must patch your local Lazarus version yourself with these two changes:
- Open unit tachartutils.pas (from (lazarus)/components/tachart) and add a function which, of course, must be declared also in the interface part of the unit:
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;
- Then open unit tasources.pas and find procedure TListChartSourceStrings.Parse. Replace each one of the three calls to StrToFloatDefSep by this new function, StrToFloatOrDateTimeDef.
Nevertheless, using the datapoints editor is not really recommended. Better to write a few lines of code to add the data points.