Automatic Axis Incorrect With TeeShapes

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
madupree
Newbie
Newbie
Posts: 1
Joined: Tue Aug 13, 2013 12:00 am

Automatic Axis Incorrect With TeeShapes

Post by madupree » Tue Aug 20, 2013 5:33 am

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

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

Re: Automatic Axis Incorrect With TeeShapes

Post by Yeray » Wed Aug 21, 2013 3:35 pm

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 2538 times
If I scroll the chart a bit to the down-left, I see the shape:
shape2.png
shape2.png (12.42 KiB) Viewed 2537 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 2541 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