mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:59:13 +02:00
TAChart: Fix TListChartSource.CopyFrom not copying additional x and y values.
This commit is contained in:
parent
b16ec6790f
commit
dddd7c85cd
@ -86,6 +86,7 @@ type
|
|||||||
|
|
||||||
TChartValueTextArray = array of TChartValueText;
|
TChartValueTextArray = array of TChartValueText;
|
||||||
|
|
||||||
|
PChartDataItem = ^TChartDataItem;
|
||||||
TChartDataItem = packed record
|
TChartDataItem = packed record
|
||||||
public
|
public
|
||||||
X, Y: Double;
|
X, Y: Double;
|
||||||
@ -93,6 +94,7 @@ type
|
|||||||
Text: String;
|
Text: String;
|
||||||
XList: TDoubleDynArray;
|
XList: TDoubleDynArray;
|
||||||
YList: TDoubleDynArray;
|
YList: TDoubleDynArray;
|
||||||
|
procedure CopyFrom(AItem: PChartDataItem);
|
||||||
function GetX(AIndex: Integer): Double;
|
function GetX(AIndex: Integer): Double;
|
||||||
function GetY(AIndex: Integer): Double;
|
function GetY(AIndex: Integer): Double;
|
||||||
procedure SetX(AIndex: Integer; const AValue: Double);
|
procedure SetX(AIndex: Integer; const AValue: Double);
|
||||||
@ -103,7 +105,6 @@ type
|
|||||||
function Point: TDoublePoint; inline;
|
function Point: TDoublePoint; inline;
|
||||||
procedure MakeUnique;
|
procedure MakeUnique;
|
||||||
end;
|
end;
|
||||||
PChartDataItem = ^TChartDataItem;
|
|
||||||
|
|
||||||
TGraphToImageFunc = function (AX: Double): Integer of object;
|
TGraphToImageFunc = function (AX: Double): Integer of object;
|
||||||
TIntegerTransformFunc = function (AX: Integer): Integer of object;
|
TIntegerTransformFunc = function (AX: Integer): Integer of object;
|
||||||
@ -536,6 +537,18 @@ end;
|
|||||||
|
|
||||||
{ TChartDataItem }
|
{ TChartDataItem }
|
||||||
|
|
||||||
|
procedure TChartDataItem.CopyFrom(AItem: PChartDataItem);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
X := AItem^.X;
|
||||||
|
Y := AItem^.Y;
|
||||||
|
SetLength(XList, Length(AItem^.XList));
|
||||||
|
for i := 0 to High(AItem^.XList) do XList[i] := AItem^.XList[i];
|
||||||
|
SetLength(YList, Length(AItem^.YList));
|
||||||
|
for i := 0 to High(AItem^.YList) do YList[i] := AItem^.YList[i];
|
||||||
|
end;
|
||||||
|
|
||||||
function TChartDataItem.GetX(AIndex: Integer): Double;
|
function TChartDataItem.GetX(AIndex: Integer): Double;
|
||||||
begin
|
begin
|
||||||
AIndex := EnsureRange(AIndex, 0, Length(XList));
|
AIndex := EnsureRange(AIndex, 0, Length(XList));
|
||||||
|
@ -717,7 +717,7 @@ begin
|
|||||||
try // optimization: don't execute try..except..end in a loop
|
try // optimization: don't execute try..except..end in a loop
|
||||||
for i := 0 to ASource.Count - 1 do begin
|
for i := 0 to ASource.Count - 1 do begin
|
||||||
pcd := NewItem;
|
pcd := NewItem;
|
||||||
pcd^ := ASource[i]^;
|
pcd^.CopyFrom(ASource[i]);
|
||||||
FData.Add(pcd); // don't use ItemAdd() here
|
FData.Add(pcd); // don't use ItemAdd() here
|
||||||
pcd := nil;
|
pcd := nil;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user