OnDrawLabel is not called when drawing the depth axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

OnDrawLabel is not called when drawing the depth axis

Post by David Novo » Thu Jul 27, 2006 1:04 am

The onDrawLabel event is only invoked for horizontal and vertical axes, but not for depth axes.


Dave

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jul 27, 2006 10:32 am

Hi Dave,

Thanks for reporting. I could reproduce the issue here and added it (TV52011624) to our defect list to be fixed for future releases. In the meantime you can try using the OnGetAxisLabel event, for example:

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;
If you are a source code customer, another option would be trying one customer, Alexey Kuznetsov, suggested in our public newsgroups:

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}
....
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Thu Jul 27, 2006 4:05 pm

Thanks Narcis,

I am a source code customer, and I've already gone with the second solution. :)

Dave

Post Reply