mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 01:39:25 +02:00
TAChart: Replace GetAxis/SetAxis and AXIS_INDEX with GetAxisByAlign/SetAxisByAlign
git-svn-id: trunk@36915 -
This commit is contained in:
parent
1bde527646
commit
4089a0fab9
@ -203,16 +203,16 @@ type
|
|||||||
public
|
public
|
||||||
function Add: TChartAxis; inline;
|
function Add: TChartAxis; inline;
|
||||||
procedure Draw(ACurrentZ: Integer; var AIndex: Integer);
|
procedure Draw(ACurrentZ: Integer; var AIndex: Integer);
|
||||||
function GetAxis(AIndex: Integer): TChartAxis;
|
function GetAxisByAlign(AAlign: TChartAxisAlignment): TChartAxis;
|
||||||
function GetEnumerator: TChartAxisEnumerator;
|
function GetEnumerator: TChartAxisEnumerator;
|
||||||
function Measure(const AExtent: TDoubleRect): TChartAxisMargins;
|
function Measure(const AExtent: TDoubleRect): TChartAxisMargins;
|
||||||
procedure Prepare(ARect: TRect);
|
procedure Prepare(ARect: TRect);
|
||||||
procedure PrepareGroups;
|
procedure PrepareGroups;
|
||||||
procedure SetAxis(AIndex: Integer; AValue: TChartAxis);
|
procedure SetAxisByAlign(AAlign: TChartAxisAlignment; AValue: TChartAxis);
|
||||||
|
|
||||||
property Axes[AIndex: Integer]: TChartAxis read GetAxes; default;
|
property Axes[AIndex: Integer]: TChartAxis read GetAxes; default;
|
||||||
property BottomAxis: TChartAxis index 1 read GetAxis write SetAxis;
|
property BottomAxis: TChartAxis index calBottom read GetAxisByAlign write SetAxisByAlign;
|
||||||
property LeftAxis: TChartAxis index 2 read GetAxis write SetAxis;
|
property LeftAxis: TChartAxis index calLeft read GetAxisByAlign write SetAxisByAlign;
|
||||||
property OnVisitSources: TChartOnVisitSources
|
property OnVisitSources: TChartOnVisitSources
|
||||||
read FOnVisitSources write FOnVisitSources;
|
read FOnVisitSources write FOnVisitSources;
|
||||||
end;
|
end;
|
||||||
@ -829,9 +829,6 @@ begin
|
|||||||
Marks.SourceDef.ValuesInRange(p, FMarkValues);
|
Marks.SourceDef.ValuesInRange(p, FMarkValues);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
|
||||||
AXIS_INDEX: array [1..2] of TChartAxisAlignment = (calBottom, calLeft);
|
|
||||||
|
|
||||||
{ TChartAxisList }
|
{ TChartAxisList }
|
||||||
|
|
||||||
function TChartAxisList.Add: TChartAxis; inline;
|
function TChartAxisList.Add: TChartAxis; inline;
|
||||||
@ -875,10 +872,10 @@ begin
|
|||||||
Result := TChartAxis(Items[AIndex]);
|
Result := TChartAxis(Items[AIndex]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChartAxisList.GetAxis(AIndex: Integer): TChartAxis;
|
function TChartAxisList.GetAxisByAlign(AAlign: TChartAxisAlignment): TChartAxis;
|
||||||
begin
|
begin
|
||||||
for Result in Self do
|
for Result in Self do
|
||||||
if Result.Alignment = AXIS_INDEX[AIndex] then exit;
|
if Result.Alignment = AAlign then exit;
|
||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -993,15 +990,16 @@ begin
|
|||||||
SetLength(FGroups, groupCount);
|
SetLength(FGroups, groupCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChartAxisList.SetAxis(AIndex: Integer; AValue: TChartAxis);
|
procedure TChartAxisList.SetAxisByAlign(
|
||||||
|
AAlign: TChartAxisAlignment; AValue: TChartAxis);
|
||||||
var
|
var
|
||||||
a: TChartAxis;
|
a: TChartAxis;
|
||||||
begin
|
begin
|
||||||
a := GetAxis(AIndex);
|
a := GetAxisByAlign(AAlign);
|
||||||
if a = nil then
|
if a = nil then
|
||||||
a := Add;
|
a := Add;
|
||||||
a.Assign(AValue);
|
a.Assign(AValue);
|
||||||
a.Alignment := AXIS_INDEX[AIndex];
|
a.Alignment := AAlign;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChartAxisList.Update(AItem: TCollectionItem);
|
procedure TChartAxisList.Update(AItem: TCollectionItem);
|
||||||
|
@ -208,7 +208,6 @@ type
|
|||||||
procedure DrawReticule(ADrawer: IChartDrawer);
|
procedure DrawReticule(ADrawer: IChartDrawer);
|
||||||
procedure FindComponentClass(
|
procedure FindComponentClass(
|
||||||
AReader: TReader; const AClassName: String; var AClass: TComponentClass);
|
AReader: TReader; const AClassName: String; var AClass: TComponentClass);
|
||||||
function GetAxis(AIndex: Integer): TChartAxis;
|
|
||||||
function GetChartHeight: Integer;
|
function GetChartHeight: Integer;
|
||||||
function GetChartWidth: Integer;
|
function GetChartWidth: Integer;
|
||||||
function GetMargins(ADrawer: IChartDrawer): TRect;
|
function GetMargins(ADrawer: IChartDrawer): TRect;
|
||||||
@ -218,7 +217,6 @@ type
|
|||||||
procedure HideReticule;
|
procedure HideReticule;
|
||||||
|
|
||||||
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
|
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
|
||||||
procedure SetAxis(AIndex: Integer; AValue: TChartAxis);
|
|
||||||
procedure SetAxisList(AValue: TChartAxisList);
|
procedure SetAxisList(AValue: TChartAxisList);
|
||||||
procedure SetAxisVisible(Value: Boolean);
|
procedure SetAxisVisible(Value: Boolean);
|
||||||
procedure SetBackColor(AValue: TColor);
|
procedure SetBackColor(AValue: TColor);
|
||||||
@ -256,6 +254,9 @@ type
|
|||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
||||||
procedure MouseUp(
|
procedure MouseUp(
|
||||||
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer); override;
|
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer); override;
|
||||||
|
protected
|
||||||
|
function GetAxisByAlign(AAlign: TChartAxisAlignment): TChartAxis;
|
||||||
|
procedure SetAxisByAlign(AAlign: TChartAxisAlignment; AValue: TChartAxis); inline;
|
||||||
protected
|
protected
|
||||||
procedure Clear(ADrawer: IChartDrawer; const ARect: TRect);
|
procedure Clear(ADrawer: IChartDrawer; const ARect: TRect);
|
||||||
procedure DisplaySeries(ADrawer: IChartDrawer);
|
procedure DisplaySeries(ADrawer: IChartDrawer);
|
||||||
@ -343,7 +344,7 @@ type
|
|||||||
property AxisList: TChartAxisList read FAxisList write SetAxisList;
|
property AxisList: TChartAxisList read FAxisList write SetAxisList;
|
||||||
property AxisVisible: Boolean read FAxisVisible write SetAxisVisible default true;
|
property AxisVisible: Boolean read FAxisVisible write SetAxisVisible default true;
|
||||||
property BackColor: TColor read FBackColor write SetBackColor default clBtnFace;
|
property BackColor: TColor read FBackColor write SetBackColor default clBtnFace;
|
||||||
property BottomAxis: TChartAxis index 1 read GetAxis write SetAxis stored false;
|
property BottomAxis: TChartAxis index calBottom read GetAxisByAlign write SetAxisByAlign stored false;
|
||||||
property Depth: TChartDistance read FDepth write SetDepth default 0;
|
property Depth: TChartDistance read FDepth write SetDepth default 0;
|
||||||
property ExpandPercentage: Integer
|
property ExpandPercentage: Integer
|
||||||
read FExpandPercentage write SetExpandPercentage default 0;
|
read FExpandPercentage write SetExpandPercentage default 0;
|
||||||
@ -352,7 +353,7 @@ type
|
|||||||
property Foot: TChartTitle read FFoot write SetFoot;
|
property Foot: TChartTitle read FFoot write SetFoot;
|
||||||
property Frame: TChartPen read FFrame write SetFrame;
|
property Frame: TChartPen read FFrame write SetFrame;
|
||||||
property GraphBrush: TBrush read FGraphBrush write SetGraphBrush;
|
property GraphBrush: TBrush read FGraphBrush write SetGraphBrush;
|
||||||
property LeftAxis: TChartAxis index 2 read GetAxis write SetAxis stored false;
|
property LeftAxis: TChartAxis index calLeft read GetAxisByAlign write SetAxisByAlign stored false;
|
||||||
property Legend: TChartLegend read FLegend write SetLegend;
|
property Legend: TChartLegend read FLegend write SetLegend;
|
||||||
property Margins: TChartMargins read FMargins write SetMargins;
|
property Margins: TChartMargins read FMargins write SetMargins;
|
||||||
property MarginsExternal: TChartMargins
|
property MarginsExternal: TChartMargins
|
||||||
@ -873,9 +874,9 @@ begin
|
|||||||
AClass := nil;
|
AClass := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChart.GetAxis(AIndex: Integer): TChartAxis;
|
function TChart.GetAxisByAlign(AAlign: TChartAxisAlignment): TChartAxis;
|
||||||
begin
|
begin
|
||||||
Result := FAxisList.GetAxis(AIndex);
|
Result := FAxisList.GetAxisByAlign(AAlign);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChart.GetChartHeight: Integer;
|
function TChart.GetChartHeight: Integer;
|
||||||
@ -1259,9 +1260,9 @@ begin
|
|||||||
StyleChanged(Self);
|
StyleChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChart.SetAxis(AIndex: Integer; AValue: TChartAxis);
|
procedure TChart.SetAxisByAlign(AAlign: TChartAxisAlignment; AValue: TChartAxis);
|
||||||
begin
|
begin
|
||||||
FAxisList.SetAxis(AIndex, AValue);
|
FAxisList.SetAxisByAlign(AAlign, AValue);
|
||||||
StyleChanged(AValue);
|
StyleChanged(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user