Page 1 of 1

Automatic Axis Incorrect With TeeShapes

Posted: Tue Aug 20, 2013 5:33 am
by 16566747
When using TeeShape and the XYStyle set to xysAxisOrigin. The value enter for the number of pixels can be interrupted as a minimum or maximum value for the axis. If X0 is 1200 Y0 is 37.87 X1 is 15 and Y1 is 15, then the minimum for the X-Axis (Bottom) is 15 and for the Left Axis is 15. While I really what the shape to be centered at 1200 and be 15 pixels wide. You are almost forced to use xysAxis
and set X0,Y0 and calculate the width and set these values to X1 and Y1
Mike DuPree

Re: Automatic Axis Incorrect With TeeShapes

Posted: Wed Aug 21, 2013 3:35 pm
by yeray
Hi,

With the code below:

Code: Select all

uses TeeShape;
procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  with Chart1.AddSeries(TChartShape) as TChartShape do
  begin
    XYStyle:=xysAxisOrigin;
    X0:=1200;
    Y0:=37.87;
    X1:=15;
    Y1:=15;
  end;
end;
I get this:
shape1.png
shape1.png (12.45 KiB) Viewed 2528 times
If I scroll the chart a bit to the down-left, I see the shape:
shape2.png
shape2.png (12.42 KiB) Viewed 2527 times
So, as you say, the axes seem to be wrongly scaled.
You can centre the shape with this:

Code: Select all

uses TeeShape;

procedure TForm1.FormCreate(Sender: TObject);
var tmp: Double;
begin
  Chart1.View3D:=false;

  with Chart1.AddSeries(TChartShape) as TChartShape do
  begin
    XYStyle:=xysAxisOrigin;
    X0:=1200;
    Y0:=37.87;
    X1:=15;
    Y1:=15;
  end;

  Chart1.Draw;
  with Chart1.Axes.Left do
  begin
    tmp:=(Maximum-Minimum)/2;
    SetMinMax(Minimum+tmp, Maximum+tmp);
  end;
  with Chart1.Axes.Bottom do
  begin
    tmp:=(Maximum-Minimum)/2;
    SetMinMax(Minimum+tmp, Maximum+tmp);
  end;
end;
shape3.png
shape3.png (12.67 KiB) Viewed 2531 times