mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-23 22:59:21 +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;
|
ds: TDataSet;
|
||||||
begin
|
begin
|
||||||
Result := @FCurItem;
|
Result := @FCurItem;
|
||||||
Inc(AIndex); // RecNo is counted from 1
|
SetDataItemDefaults(FCurItem);
|
||||||
if not FDataLink.Active then exit;
|
if not FDataLink.Active then exit;
|
||||||
|
|
||||||
|
Inc(AIndex); // RecNo is counted from 1
|
||||||
ds := FDataLink.DataSet;
|
ds := FDataLink.DataSet;
|
||||||
if ds.IsUniDirectional then begin
|
if ds.IsUniDirectional then begin
|
||||||
if ds.RecNo < AIndex then
|
if ds.RecNo < AIndex then
|
||||||
|
@ -193,6 +193,7 @@ type
|
|||||||
|
|
||||||
function DoublePoint(const ACoord: TChartDataItem): TDoublePoint; inline; overload;
|
function DoublePoint(const ACoord: TChartDataItem): TDoublePoint; inline; overload;
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
procedure SetDataItemDefaults(var AItem: TChartDataItem);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -230,6 +231,14 @@ begin
|
|||||||
[TListChartSource, TRandomChartSource, TUserDefinedChartSource]);
|
[TListChartSource, TRandomChartSource, TUserDefinedChartSource]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SetDataItemDefaults(var AItem: TChartDataItem);
|
||||||
|
begin
|
||||||
|
AItem.X := 0;
|
||||||
|
AItem.Y := 0;
|
||||||
|
AItem.Color := clTAColor;
|
||||||
|
AItem.Text := '';
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCustomChartSource }
|
{ TCustomChartSource }
|
||||||
|
|
||||||
procedure TCustomChartSource.AfterDraw;
|
procedure TCustomChartSource.AfterDraw;
|
||||||
@ -766,9 +775,7 @@ end;
|
|||||||
|
|
||||||
function TUserDefinedChartSource.GetItem(AIndex: Integer): PChartDataItem;
|
function TUserDefinedChartSource.GetItem(AIndex: Integer): PChartDataItem;
|
||||||
begin
|
begin
|
||||||
FItem.X := 0;
|
SetDataItemDefaults(FItem);
|
||||||
FItem.Y := 0;
|
|
||||||
FItem.Color := clTAColor;
|
|
||||||
if Assigned(FOnGetChartDataItem) then
|
if Assigned(FOnGetChartDataItem) then
|
||||||
FOnGetChartDataItem(Self, AIndex, FItem);
|
FOnGetChartDataItem(Self, AIndex, FItem);
|
||||||
Result := @FItem;
|
Result := @FItem;
|
||||||
|
Loading…
Reference in New Issue
Block a user