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