Hello,
We've just implemented the new
Distance
property, closing the ticket
#2740.
Since you own the sources, you can apply the main changes to your copy of the sources, at TeEngine.pas and rebuild&reinstall the sources with TeeRecompile.
Code: Select all
diff --git a/TeEngine.pas b/TeEngine.pas
index cffb80a4..64525987 100644
--- a/TeEngine.pas
+++ b/TeEngine.pas
@@ -435,17 +435,19 @@ type
TAxisTitlePosition=(tpStart, tpCenter, tpEnd);
TChartAxisTitle=class(TCustomTextShape)
private
+ FDistance : Integer;
FPosition : TAxisTitlePosition;
IDefaultAngle : Integer;
function GetCaption:String;
Function IsAngleStored:Boolean;
Procedure SetCaption(Const Value:String);
+ Procedure SetDistance(Const Value:Integer);
Procedure SetPosition(Const Value:TAxisTitlePosition);
public
Constructor Create(const AOwner: TCustomTeePanel); override;
Procedure Assign(Source:TPersistent); override;
@@ -453,10 +455,11 @@ type
function Clicked(x,y:Integer):Boolean; overload;
Function Clicked(const P:TPoint):Boolean; overload;
published
property Angle stored IsAngleStored nodefault;
property Caption:String read GetCaption write SetCaption;
+ property Distance:Integer read FDistance write SetDistance default 0;
property Font;
property Position:TAxisTitlePosition read FPosition write SetPosition default tpCenter;
property TextAlignment default taCenter;
property Visible default True;
@@ -3508,10 +3511,11 @@ end;
Procedure TChartAxisTitle.Assign(Source:TPersistent);
Begin
if Source is TChartAxisTitle then
With TChartAxisTitle(Source) do
Begin
+ Self.FDistance:=FDistance;
Self.FPosition:=FPosition;
end;
inherited;
end;
@@ -3549,10 +3553,19 @@ end;
function TChartAxisTitle.Clicked(x,y:Integer):Boolean;
begin
result:=Visible and (Caption<>'') and ClickedShape(TeePoint(x,y),ShapeBounds);
end;
+Procedure TChartAxisTitle.SetDistance(Const Value:Integer);
+begin
+ if FDistance<>Value then
+ begin
+ FDistance:=Value;
+ Repaint;
+ end;
+end;
+
{ TChartAxisPen }
Constructor TChartAxisPen.Create(const OnChangeEvent:TNotifyEvent);
Begin
inherited;
@@ -7802,10 +7815,11 @@ Procedure TChartAxis.CalcRect(var R:TRect; InflateChartRectangle:Boolean);
var tmp : Integer;
t : Integer;
tmpMargin : Integer;
tmpTitleSize : Integer;
tmpHasTitle : Boolean;
+ tmpDistance : Integer;
begin
// If this axis has any child subaxes, process them first:
if Assigned(FSubAxes) then
for t:=0 to FSubAxes.Count-1 do
@@ -7829,11 +7843,28 @@ begin
if tmpHasTitle then
begin
with FAxisTitle do
tmpTitleSize:=InternalCalcSize(FAxisTitle,Angle,Caption,FTitleSize);
- FPosTitle:=CalcLabelsRect(tmpTitleSize);
+ tmpDistance:=0;
+ if FAxisTitle.Distance<>0 then
+ begin
+ if Horizontal then
+ if OtherSide then
+ tmpDistance:=-FAxisTitle.Distance
+ else
+ tmpDistance:=FAxisTitle.Distance
+ else
+ if OtherSide then
+ tmpDistance:=FAxisTitle.Distance
+ else
+ tmpDistance:=-FAxisTitle.Distance;
+
+ InflateAxisRect(R,FAxisTitle.Distance);
+ end;
+
+ FPosTitle:=CalcLabelsRect(tmpTitleSize)+tmpDistance;
end;
if FLabels.Visible then
begin
// Reset to zero, to force recalculation at SizeLabels