OnDrawLabel is not called when drawing the depth axis
Posted: Thu Jul 27, 2006 1:04 am
The onDrawLabel event is only invoked for horizontal and vertical axes, but not for depth axes.
Dave
Dave
Steema Software - Customer Support Forums
https://407832.verdetrade-hk.tech/support/
https://407832.verdetrade-hk.tech/support/viewtopic.php?f=3&t=4447
Code: Select all
procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
if (sender = Chart1.Axes.Depth) then
LabelText:='Hi!';
end;
Code: Select all
unit TeEngine;
.... somewhere in this unit add or modify lines marked with {kuaw} ...
Procedure DrawThisLabel(LabelPos:Integer; Const tmpSt:String;
Format:TTeeCustomShape=nil);
var tmpZ : Integer;
tmpPos : Integer;
{kuaw}tmpY: integer;
{kuaw}tmpDraw: boolean;
{kuaw}tmpS: string;
begin
if TickOnLabelsOnly then
AddTick(LabelPos);
With ParentChart,Canvas do
begin
if Assigned(Format) then AssignFont(Format.Font)
else AssignFont(Items.Format.Font);
// trick
Brush.Style:=bsSolid;
Brush.Style:=bsClear;
{$IFDEF CLX}
BackMode:=cbmTransparent;
{$ENDIF}
if IsDepthAxis then
begin
TextAlign:=DepthAxisAlign;
if (View3DOptions.Rotation=360) or View3DOptions.Orthogonal then
tmpZ:=LabelPos+(FontHeight div 2)
else
tmpZ:=LabelPos;
if OtherSide then tmpPos:=PosLabels
else tmpPos:=PosLabels-2-(TextWidth('W') div 2);
{kuaw} tmpY := DepthAxisPos;
{kuaw} tmpS := tmpSt;
{kuaw} tmpDraw := true;
{kuaw} if Assigned(FOnDrawLabel) then // 7.0
{kuaw} FOnDrawLabel(Self,tmpPos, tmpY, tmpZ, tmpS, tmpDraw);
{kuaw} if (tmpDraw) then TextOut3D(tmpPos, tmpY, tmpZ, tmpS);
{kuaw: was simply TextOut3D(tmpPos,DepthAxisPos,tmpZ,tmpSt); without
calling OnDrawLabel event}
....