mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 07:39:28 +02:00
TAChart: Set default values correctly in db-aware chart source
git-svn-id: trunk@20220 -
This commit is contained in:
parent
62cc5113b7
commit
7ee8494e64
@ -163,8 +163,10 @@ var
|
||||
ds: TDataSet;
|
||||
begin
|
||||
Result := @FCurItem;
|
||||
Inc(AIndex); // RecNo is counted from 1
|
||||
SetDataItemDefaults(FCurItem);
|
||||
if not FDataLink.Active then exit;
|
||||
|
||||
Inc(AIndex); // RecNo is counted from 1
|
||||
ds := FDataLink.DataSet;
|
||||
if ds.IsUniDirectional then begin
|
||||
if ds.RecNo < AIndex then
|
||||
|
@ -193,6 +193,7 @@ type
|
||||
|
||||
function DoublePoint(const ACoord: TChartDataItem): TDoublePoint; inline; overload;
|
||||
procedure Register;
|
||||
procedure SetDataItemDefaults(var AItem: TChartDataItem);
|
||||
|
||||
implementation
|
||||
|
||||
@ -230,6 +231,14 @@ begin
|
||||
[TListChartSource, TRandomChartSource, TUserDefinedChartSource]);
|
||||
end;
|
||||
|
||||
procedure SetDataItemDefaults(var AItem: TChartDataItem);
|
||||
begin
|
||||
AItem.X := 0;
|
||||
AItem.Y := 0;
|
||||
AItem.Color := clTAColor;
|
||||
AItem.Text := '';
|
||||
end;
|
||||
|
||||
{ TCustomChartSource }
|
||||
|
||||
procedure TCustomChartSource.AfterDraw;
|
||||
@ -766,9 +775,7 @@ end;
|
||||
|
||||
function TUserDefinedChartSource.GetItem(AIndex: Integer): PChartDataItem;
|
||||
begin
|
||||
FItem.X := 0;
|
||||
FItem.Y := 0;
|
||||
FItem.Color := clTAColor;
|
||||
SetDataItemDefaults(FItem);
|
||||
if Assigned(FOnGetChartDataItem) then
|
||||
FOnGetChartDataItem(Self, AIndex, FItem);
|
||||
Result := @FItem;
|
||||
|
Loading…
Reference in New Issue
Block a user