Axis captions in OpenGL

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JonM
Newbie
Newbie
Posts: 23
Joined: Tue Sep 14, 2004 4:00 am
Location: UK

Axis captions in OpenGL

Post by JonM » Tue Aug 28, 2012 9:07 am

Hi

I have been making a 3D OpenGL plot. The axis caption titles for the Depth and Right Axes are not plotted in the correct position (I believe this is a know bug). Hence I am trying to custom draw these titles using an after draw. The problem is I cannot figure out how to accurately find the position of the axes on the plot. Currently I am using for the Depth axis caption :

Code: Select all

procedure TCapPressFuncXplot.Draw3DAxisLabels;
Var
   fTchart : TChart;
   fCanvas : TCanvas3D;
   x, y, z : Integer;
begin
   fTchart := XplotChartFrm.Chart1;
   fCanvas := fTchart.Canvas;
   fCanvas.Font.Size := fTchart.DepthAxis.Title.Font.Size;
   fCanvas.Font.Color := fTchart.DepthAxis.Title.Font.Color;
   x := fTchart.ChartWidth - fTchart.MarginLeft;
   y := fTchart.ChartHeight - fTchart.MarginTop;
   Z := fTchart.Width3D div 2;
   fCanvas.TextOut3D(X,Y,Z,fTchart.DepthAxis.Title.Caption);
end;
This puts the Caption in the right place for the Depth Axis but the X position is too far to the right and the Y position is too high.
What is the correct method for calculating the X and Y values (should be bottom right corner of plot) for use in the routine TextOut3D.

Thanks Frank

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Axis captions in OpenGL

Post by Yeray » Wed Aug 29, 2012 1:33 pm

Hi Frank,

You should use positions relative to the axes position. Ie, this seems to work fine for me here:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var x, y, z: Integer;
begin
  x:=Chart1.Axes.Bottom.IEndPos + 20;
  y:=Chart1.Axes.Bottom.PosAxis;
  z:=Chart1.Axes.Depth.IAxisSize div 2;

  Chart1.Canvas.TextOut3D(x, y, z, 'my text');
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply