Page 2 of 2

Re: TChart disabled on 64Bit iOS platform

Posted: Wed Sep 09, 2015 2:41 pm
by 16561419
Hello Yeray,

>I've tried it with v2015.15 and v2015.16 in Android and it seems to give the same result. Could you please specify what two versions to compare?
You are right, its only OK when using Tchart VCL in OpenGL mode.
Native painting shows indeed the same bug than the FMX version.
Will this problem ever get fixed ?

>The depth axis is not visible. It will appear if you make it visible:
No, I just had a look, the depth axis was definitely set to visible but it was not visible on my iPhone.
There is still a problem with this axis title.

best regards,

X-ray

Re: TChart disabled on 64Bit iOS platform

Posted: Thu Sep 10, 2015 6:55 am
by 16561419
Hello Yeray,

I tried your code to draw the bottom axis title, that indeed helps to displace it and making it completely visible.
Could you please post the source code for the Left axis title too,
taking into account to draw the axis title from bottom to top (not from left to right) ?

best regards,

X-Ray

Re: TChart disabled on 64Bit iOS platform

Posted: Mon Sep 14, 2015 9:28 am
by yeray
Hello,

This is quite similar to the code for the bottom axis title:

Code: Select all

uses System.Math, FMXTee.Constants, FMXTee.Tools, FMXTee.Canvas;

type
  TCanvasAccess=class(TCanvas3D);

//...
procedure TForm1.FormCreate(Sender: TObject);
//...
  Chart1.Axes.Left.Title.Text:='Y-Axis Title';
  Chart1.Axes.Bottom.Title.Text:='X-Axis Title';
  Chart1.Axes.Depth.Visible:=true;

  with TFlatTheme.Create(Chart1) do
  try
    Apply;
  finally
    Free;
  end;

  Chart1.Aspect.Zoom:=70;
  Chart1.Aspect.Orthogonal:=false;

  Chart1.Axes.Depth.Axis.Assign(Chart1.Axes.Bottom.Axis);
  Chart1.Axes.Depth.LabelsFont.Assign(Chart1.Axes.Bottom.LabelsFont);
  Chart1.Axes.Left.Title.Visible:=false;
  Chart1.Axes.Bottom.Title.Visible:=false;
end;

//...

procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
var xOffset, yOffset, tmpZ, tmpW: Integer;
    pos: TPointF;
    st: string;
begin
  xOffset:=10;
  yOffset:=10;

  with Chart1.Axes.Bottom do
  begin
    st:=Title.Caption;
    Chart1.Canvas.AssignFont(Title.Font);
    tmpW:=Chart1.Canvas.TextWidth(st);

    pos.X:=IStartPos + ((IEndPos-IStartPos) div 2);// - (tmpW div 2);
    pos.Y:=Round(PosAxis + Abs(LabelsFont.Size) + TickLength + 7);
    tmpZ:=Round(Chart1.Width3D * ZPosition * 0.01);
  end;

  pos:=Chart1.Canvas.Calculate3DPosition(pos,tmpZ);
  pos.Y:=pos.Y+yOffset;

  Chart1.Canvas.TextOut(pos.X, pos.Y, st);

  with Chart1.Axes.Left do
  begin
    st:=Chart1.Axes.Left.Title.Caption;
    Chart1.Canvas.AssignFont(Title.Font);
    tmpW:=Chart1.Canvas.TextWidth(st);

    pos.Y:=IStartPos + ((IEndPos-IStartPos) div 2) - 2;// - (tmpW div 2);
    pos.X:=Round(PosAxis - MaxLabelsWidth - TickLength - 49);
    tmpZ:=Round(Chart1.Width3D * ZPosition * 0.01);
  end;

  pos:=Chart1.Canvas.Calculate3DPosition(pos,tmpZ);
  pos.X:=pos.X-xOffset;

  TCanvasAccess(Chart1.Canvas).IUseTextCenter:=True;
  TCanvasAccess(Chart1.Canvas).ITextCenter:=pos;
  Chart1.Canvas.RotateLabel(Round(pos.X), Round(pos.Y), st, 90);
  TCanvasAccess(Chart1.Canvas).IUseTextCenter:=False;
end;
It basically adds the complexity of the rotation of the text.