mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:59:20 +02:00
TAChart: Use partial arrays instead of pointers to implement TListChartSource.AddXYList
git-svn-id: trunk@37580 -
This commit is contained in:
parent
646859d7e7
commit
7ef45b44d0
@ -39,7 +39,6 @@ type
|
|||||||
function NewItem: PChartDataItem;
|
function NewItem: PChartDataItem;
|
||||||
procedure SetDataPoints(AValue: TStrings);
|
procedure SetDataPoints(AValue: TStrings);
|
||||||
procedure SetSorted(AValue: Boolean);
|
procedure SetSorted(AValue: Boolean);
|
||||||
procedure SetYListInternal(AIndex, ACount: Integer; AYList: PDouble);
|
|
||||||
procedure UpdateCachesAfterAdd(AX, AY: Double);
|
procedure UpdateCachesAfterAdd(AX, AY: Double);
|
||||||
protected
|
protected
|
||||||
function GetCount: Integer; override;
|
function GetCount: Integer; override;
|
||||||
@ -394,7 +393,7 @@ begin
|
|||||||
raise EYListEmptyError.Create('AddXYList: Y List is empty');
|
raise EYListEmptyError.Create('AddXYList: Y List is empty');
|
||||||
Result := Add(AX, AY[0], ALabel, AColor);
|
Result := Add(AX, AY[0], ALabel, AColor);
|
||||||
if Length(AY) > 1 then
|
if Length(AY) > 1 then
|
||||||
SetYListInternal(Result, High(AY), @AY[1]);
|
SetYList(Result, AY[1..High(AY)]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TListChartSource.Clear; inline;
|
procedure TListChartSource.Clear; inline;
|
||||||
@ -573,17 +572,11 @@ end;
|
|||||||
|
|
||||||
procedure TListChartSource.SetYList(
|
procedure TListChartSource.SetYList(
|
||||||
AIndex: Integer; const AYList: array of Double);
|
AIndex: Integer; const AYList: array of Double);
|
||||||
begin
|
|
||||||
SetYListInternal(AIndex, Length(AYList), @AYList[0]);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TListChartSource.SetYListInternal(
|
|
||||||
AIndex, ACount: Integer; AYList: PDouble);
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
with Item[AIndex]^ do
|
with Item[AIndex]^ do
|
||||||
for i := 0 to Min(High(YList), ACount - 1) do
|
for i := 0 to Min(High(AYList), High(YList)) do
|
||||||
YList[i] := AYList[i];
|
YList[i] := AYList[i];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user