Page 2 of 2

Re: iso axes but also scaled

Posted: Fri Oct 16, 2015 9:15 pm
by 16475383
Always one more change. What I sent is not exactly correct. If one makes the window very large and measures it one will see that it is not exactly isometric. This is because the chart margins are expressed as percentages. Thus the margins will change as one adjusts the size of the plot. Setting the margin units to maPixels fixes that problem - at least to the resolution of my screen. I guess the other thing one should add are calls to GetDeviceCaps in case one uses a device that does not have square pixels. It would be nice if these adjustments could be included within TeeChart.

Re: iso axes but also scaled

Posted: Mon Oct 19, 2015 12:09 pm
by yeray
Hello,
fjrohlf wrote:What I sent is not exactly correct.
I think this simple code could be used to check the quality of any approach:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var x, y, tmp: Integer;
    XYScreen : Double;
begin
  XYScreen:=1.0*(GetDeviceCaps(Canvas.Handle,HORZSIZE)/Screen.Width)/
                (GetDeviceCaps(Canvas.Handle,VERTSIZE)/Screen.Height);

  tmp:=500;
  x:=Chart1.ChartRect.Left;
  y:=Chart1.ChartRect.Top;
  Chart1.Canvas.Pen.Color:=clRed;
  Chart1.Canvas.Line(x, y, x+tmp, Round(y+(tmp*XYScreen)));
  y:=Chart1.ChartRect.Bottom;
  Chart1.Canvas.Line(x, y, x+tmp, Round(y-(tmp*XYScreen)));
end;
I understand these red lines should be exactly drawn at 45º and the grid lines in a perfectly isometric chart should cross with that red lines.
fjrohlf wrote:It would be nice if these adjustments could be included within TeeChart.
I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1344

Re: iso axes but also scaled

Posted: Mon Oct 19, 2015 2:03 pm
by 16475383
Thanks but it is difficult to measure whether an angle is exactly 45 degrees. It is easier to measure whether a vertical and a horizontal line that should be equal in length actually are equal in length. That is what I have been doing to test.

Re: iso axes but also scaled

Posted: Mon Oct 19, 2015 3:12 pm
by yeray
Hello,
fjrohlf wrote:Thanks but it is difficult to measure whether an angle is exactly 45 degrees.
I've checked it as follows:
Take a screenshot and open the image with Paint.Net.
Draw 45º lines over the red lines by pressing "o", clicking on the start of a red line and pressing "shift" while dragging.
Actually, I get a better result when considering sqare pixels, without using GetDeviceCaps to draw the 45º red lines:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var x, y, tmp: Integer;
begin
  tmp:=500;
  x:=Chart1.ChartRect.Left;
  y:=Chart1.ChartRect.Top;
  Chart1.Canvas.Pen.Color:=clRed;
  Chart1.Canvas.Line(x, y, x+tmp, y+tmp);
  y:=Chart1.ChartRect.Bottom;
  Chart1.Canvas.Line(x, y, x+tmp, y-tmp);
end;
fjrohlf wrote:It is easier to measure whether a vertical and a horizontal line that should be equal in length actually are equal in length. That is what I have been doing to test.
I was trying to give a way to measure in the same test project but it's not so easy.

Re: iso axes but also scaled

Posted: Thu Feb 09, 2017 9:37 am
by 16579481
I am just checking back and trying to use TeeChart again. I was surprised to see that this still seems to be a problem. I would have thought by now there simply would be a checkbox to produce axes with the proper aspect ratio. Why cannot one produce charts that stay square even if a user stretches the window to make a chart larger or smaller? Is there an option that I cannot find?

Re: iso axes but also scaled

Posted: Fri Feb 10, 2017 9:15 am
by yeray
Hello,

I'm afraid the issue hasn't been closed. I've incremented the "Importance" flag of the ticket.

Re: iso axes but also scaled

Posted: Fri Feb 10, 2017 6:42 pm
by 16579481
Thanks!