Axes titles and labels in 3D

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Miket1655
Newbie
Newbie
Posts: 4
Joined: Tue Mar 13, 2018 12:00 am
Contact:

Axes titles and labels in 3D

Post by Miket1655 » Wed May 23, 2018 2:21 pm

Hello,

Is it possible to achieve 3D effect on axes titles and labels as shown at the attached screenshot?
Please, note that OpenGL rendering doesn't work correctly for the case of surface series.
Example3D.jpg
Example3D.jpg (34.15 KiB) Viewed 13644 times
Best wishes,
Michael

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

Re: Axes titles and labels in 3D

Post by Yeray » Mon May 28, 2018 12:08 pm

Hello,
Miket1655 wrote:Is it possible to achieve 3D effect on axes titles and labels as shown at the attached screenshot?
The texts can be rotated manually. Here an example doing it for the Depth axis:

Code: Select all

uses TeCanvas, Math;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Axes.Depth.Title.Hide;

  Chart1.Draw;
  ChartTool1Rotate(Self);
end;

procedure TForm1.ChartTool1Rotate(Sender: TObject);
var aStart, aEnd: TPoint;
    aStart2D, aEnd2D: TPoint3D;
    aAngle: Double;
begin
  aStart2D.x:=Chart1.Axes.Bottom.IStartPos;
  aStart2D.y:=Chart1.ChartRect.Bottom;
  aStart2D.z:=Round(Chart1.Aspect.ZOffset);
  aStart:=Chart1.Canvas.Calculate3DPosition(aStart2D);

  aEnd2D.x:=Chart1.Axes.Bottom.IEndPos;
  aEnd2D.y:=Chart1.ChartRect.Bottom;
  aEnd2D.z:=Round(Chart1.Aspect.ZOffset);
  aEnd:=Chart1.Canvas.Calculate3DPosition(aEnd2D);

  aAngle:=ArcTan2(aEnd.Y-aStart.Y, aEnd.X-aStart.X);
  Chart1.Axes.Bottom.Title.Angle:=360-Round(aAngle/TeePiStep);

  aStart2D.x:=Chart1.Axes.Depth.PosAxis;
  aStart2D.y:=Chart1.ChartRect.Bottom;
  aStart2D.z:=Chart1.Axes.Depth.IStartPos;
  aStart:=Chart1.Canvas.Calculate3DPosition(aStart2D);

  aEnd2D.x:=Chart1.Axes.Depth.PosAxis;
  aEnd2D.y:=Chart1.ChartRect.Bottom;
  aEnd2D.z:=Chart1.Axes.Depth.IEndPos;
  aEnd:=Chart1.Canvas.Calculate3DPosition(aEnd2D);

  aAngle:=ArcTan2(aEnd.Y-aStart.Y, aEnd.X-aStart.X);
  Chart1.Axes.Depth.Title.Angle:=360-Round(aAngle/TeePiStep);
end;

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
const off = 20;
begin
  Chart1.Canvas.AssignFont(Chart1.Axes.Depth.Title.Font);
  Chart1.Canvas.RotateLabel3D(Chart1.Axes.Depth.PosAxis + off,
         Chart1.ChartRect.Bottom-Round(Chart1.ChartHeight*Chart1.Axes.Depth.ZPosition*0.01) + off,
         (Chart1.Width3D div 2),
         Chart1.Axes.Depth.Title.Caption,Chart1.Axes.Depth.Title.Angle,
         Chart1.Axes.Depth.Title.TextFormat=ttfHtml);
end;
Miket1655 wrote:Please, note that OpenGL rendering doesn't work correctly for the case of surface series.
If that's a known issue, could you please add a link to where it was reported so we can review it?
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

Miket1655
Newbie
Newbie
Posts: 4
Joined: Tue Mar 13, 2018 12:00 am
Contact:

Re: Axes titles and labels in 3D

Post by Miket1655 » Sun Jun 03, 2018 9:23 pm

Dear Yeray,

Thank you for the proposed solution, I will try to use it. Of course, it would be nice to have the discussed option "out-of-box" without necessity of an additional code!

Concerning OpenGL problems (I am using the latest official release 2018.24.180321 of TeeChart Pro): please, have a look how Tee9new.exe examples work in OpenGL and GDI modes, namely the examples "Surface Smoothing", "TriSurface Hiding". The size and viewpoint position changes very significantly between these modes, the similar situation happens with other 3D plot types, like surface plots.

Best wishes,
Michael

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

Re: Axes titles and labels in 3D

Post by Yeray » Tue Jun 05, 2018 8:04 am

Hello Michael,
Miket1655 wrote:Concerning OpenGL problems (I am using the latest official release 2018.24.180321 of TeeChart Pro): please, have a look how Tee9new.exe examples work in OpenGL and GDI modes, namely the examples "Surface Smoothing", "TriSurface Hiding". The size and viewpoint position changes very significantly between these modes, the similar situation happens with other 3D plot types, like surface plots.
Here how the "Surface_Smooth" example looks by default using GDIPlus:
Tee9new_2018-06-05_10-06-04.png
Tee9new_2018-06-05_10-06-04.png (202.76 KiB) Viewed 13598 times
Changing the Canas to OpenGL from the status bar contextual menu also changes the zoom. Is this what you mean?
Tee9new_2018-06-05_10-05-50.png
Tee9new_2018-06-05_10-05-50.png (183.55 KiB) Viewed 13601 times
However, if you change the Canvas from the "Chart\3D\Render" tab, and you unselect "Orthogonal" checkbox from the "Chart\3D\Options" tab, it looks much better:
Tee9new_2018-06-05_10-03-44.png
Tee9new_2018-06-05_10-03-44.png (208.88 KiB) Viewed 13600 times
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

Miket1655
Newbie
Newbie
Posts: 4
Joined: Tue Mar 13, 2018 12:00 am
Contact:

Re: Axes titles and labels in 3D

Post by Miket1655 » Tue Jun 05, 2018 8:36 pm

Dear Yeray,

Yes, I mean sudden and very large changes of scale and viewpoint when switching between GDI and OpenGL rendering. You can see them in the mentioned examples, and you demonstrated them as well.

In principle, any change of rendering should not change a view so dramatically, otherwise user experience will not be satisfactory. Maybe this effect can be a bit minimized with some additional code (changing some properties when the rendering engine is changed), but again it would be nice to have this implemented "out-of-box", as well as rotated labels and axes captions!

Maybe your team can consider these features as a proposal for the next upgrade?

Best regards,
Michael

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

Re: Axes titles and labels in 3D

Post by Yeray » Tue Jun 12, 2018 7:52 am

Hello,

I'm still not sure to understand where are you exactly observing this unexpected behaviour. Do you see it when changing the rendering in the contextual menu of the bottom bar in the demo, in the editor or changing it by code?
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

Miket1655
Newbie
Newbie
Posts: 4
Joined: Tue Mar 13, 2018 12:00 am
Contact:

Re: Axes titles and labels in 3D

Post by Miket1655 » Sun Jun 17, 2018 7:22 pm

Hello,

Thank you for the hint, I was not aware of right-click status bar menu in this Demo. Because of this I listed only examples with explicit "OpenGL" option. Using this menu I can say that most of 3D examples have this problem: the size and in most cases viewpoint are changing very significantly when I switch between OpenGL and GDI renderings.

The same happens in my project if I switch rendering in the code. In my view it is a big issue preventing me from using OpenGL rendering without additional tweaks.

Best wishes,
Michael

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

Re: Axes titles and labels in 3D

Post by Yeray » Mon Jun 18, 2018 9:27 am

Hello,

Using the "SeriesType_Surface" example, by default you can see these Aspect settings:
Tee9new_2018-06-18_11-23-50.png
Tee9new_2018-06-18_11-23-50.png (15.84 KiB) Viewed 13523 times
Changing to OpenGL using the contextual menu, it changes the Zoom:
2018-06-18_11-20-07.gif
2018-06-18_11-20-07.gif (364.15 KiB) Viewed 13522 times
If, instead of using the contextual menu, you change to OpenGL through the Editor, nothing else is modified and it looks good:
2018-06-18_11-20-33.gif
2018-06-18_11-20-33.gif (396.7 KiB) Viewed 13521 times
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