mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-17 00:59:24 +02:00
TAChart: Add TListChartSource.AddXYList method
git-svn-id: trunk@37577 -
This commit is contained in:
parent
4c44d87614
commit
3aa1d2ee1d
@ -39,6 +39,7 @@ 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;
|
||||||
@ -51,6 +52,9 @@ type
|
|||||||
function Add(
|
function Add(
|
||||||
AX, AY: Double; const ALabel: String = '';
|
AX, AY: Double; const ALabel: String = '';
|
||||||
AColor: TChartColor = clTAColor): Integer;
|
AColor: TChartColor = clTAColor): Integer;
|
||||||
|
function AddXYList(
|
||||||
|
AX: Double; const AY: array of Double; const ALabel: String = '';
|
||||||
|
AColor: TChartColor = clTAColor): Integer;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure CopyFrom(ASource: TCustomChartSource);
|
procedure CopyFrom(ASource: TCustomChartSource);
|
||||||
procedure Delete(AIndex: Integer);
|
procedure Delete(AIndex: Integer);
|
||||||
@ -379,6 +383,14 @@ begin
|
|||||||
Notify;
|
Notify;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TListChartSource.AddXYList(
|
||||||
|
AX: Double; const AY: array of Double;
|
||||||
|
const ALabel: String; AColor: TChartColor): Integer;
|
||||||
|
begin
|
||||||
|
Result := Add(AX, AY[0], ALabel, AColor);
|
||||||
|
SetYListInternal(Result, High(AY), @AY[1]);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TListChartSource.Clear; inline;
|
procedure TListChartSource.Clear; inline;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -555,11 +567,17 @@ 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(AYList), High(YList)) do
|
for i := 0 to Min(High(YList), ACount - 1) do
|
||||||
YList[i] := AYList[i];
|
YList[i] := AYList[i];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user