Page 1 of 1

Axes titles and labels in 3D

Posted: Wed May 23, 2018 2:21 pm
by 16583215
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 13700 times
Best wishes,
Michael

Re: Axes titles and labels in 3D

Posted: Mon May 28, 2018 12:08 pm
by yeray
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?

Re: Axes titles and labels in 3D

Posted: Sun Jun 03, 2018 9:23 pm
by 16583215
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

Re: Axes titles and labels in 3D

Posted: Tue Jun 05, 2018 8:04 am
by yeray
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 13654 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 13657 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 13656 times

Re: Axes titles and labels in 3D

Posted: Tue Jun 05, 2018 8:36 pm
by 16583215
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

Re: Axes titles and labels in 3D

Posted: Tue Jun 12, 2018 7:52 am
by yeray
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?

Re: Axes titles and labels in 3D

Posted: Sun Jun 17, 2018 7:22 pm
by 16583215
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

Re: Axes titles and labels in 3D

Posted: Mon Jun 18, 2018 9:27 am
by yeray
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 13579 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 13578 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 13577 times