Can I adjust TeeChart's y-axis like this attachment?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
HCLab
Newbie
Newbie
Posts: 9
Joined: Wed Jan 31, 2007 12:00 am

Can I adjust TeeChart's y-axis like this attachment?

Post by HCLab » Mon Jul 13, 2009 5:53 am

when i have data like attachment image
can i adjust y - axis value like chart below?

i need that the space between value 300 and 800 is displayed rather upper chart than bottom.

TeeChart has some property that i could do?
Attachments
yaxis.jpg
yaxis.jpg (76.11 KiB) Viewed 8307 times

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

Re: Can I adjust TeeChart's y-axis like this attachment?

Post by Yeray » Mon Jul 13, 2009 8:36 am

Hi HCLab,

The easiest solution could be using a custom axis to separate the two parts. The above with the default left axis and the below part with the custom axis. This could be an example:

Code: Select all

uses series;

procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
begin
  Chart1.View3D := false;

  for i:=0 to 2 do
  begin
    Chart1.AddSeries(TFastLineSeries.Create(self));

    if i <> 2 then
    begin
      Chart1[i].Add(random*300+800);
      for j:=1 to 25 do
        Chart1[i].Add(random*50 + Chart1[i].YValue[j-1] - 25);
    end
    else
      for j:=0 to 25 do
        Chart1[i].Add(200);
  end;

  Chart1.CustomAxes.Add;
  Chart1[2].CustomVertAxis := Chart1.CustomAxes.Items[0];

  Chart1.Axes.Left.EndPosition := 59;
  Chart1.CustomAxes.Items[0].StartPosition := 61;
end;
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

HCLab
Newbie
Newbie
Posts: 9
Joined: Wed Jan 31, 2007 12:00 am

Re: Can I adjust TeeChart's y-axis like this attachment?

Post by HCLab » Mon Jul 13, 2009 9:01 am

Thanks you Yeray.

Im gonna try with it.
Hav nice day :3

HCLab
Newbie
Newbie
Posts: 9
Joined: Wed Jan 31, 2007 12:00 am

Re: Can I adjust TeeChart's y-axis like this attachment?

Post by HCLab » Tue Jul 14, 2009 4:29 am

Code: Select all


  Chart1.Axes.Left.EndPosition := 59;
  Chart1.CustomAxes.Items[0].StartPosition := 61;
end;
Thanks for your reply but I cant understand what this codes means ...
Can you Explain what these property means ?
I cant read Teechart Help File on Vista ...

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

Re: Can I adjust TeeChart's y-axis like this attachment?

Post by Yeray » Tue Jul 14, 2009 9:46 am

Hi HCLab,

You can download WinHlp32.exe for Windows Vista from microsoft website to continue viewing hlp files.

Here is what the help says:
TChartAxis.StartPosition wrote:property StartPosition: Double;
Unit
TeEngine

Description
Default = 0

The StartPosition property defines the position, as a percentage of Chart width or height (depending on whether it is applied to a Horizontal Axis or a Vertical Axis) of the Start position of the Axis to which it is applied. Left and Top are 0,0 positions.

Use with PositionPercent and EndPosition properties to define the Axis position on a Chart.
TChartAxis.EndPosition wrote:property EndPosition: Double;

Unit
TeEngine

Description
Default = 0

The EndPosition property defines the position, as a percentage of Chart width or height (depending on whether it is applied to a Horizontal Axis or a Vertical Axis) of the End position of the Axis to which it is applied. Left and Top are 0,0 positions.

Use with StartPosition and PositionPercent properties to define the Axis position on a Chart.
TChartAxis.PositionPercent wrote:property PositionPercent: Double;

Unit
TeEngine

Description
Default = 0

The PositionPercent property defines the position, (as a percentage of Chart width or height or as pixels) (depending on whether it is applied to a Horizontal Axis or a Vertical Axis) of the Position of the Axis to which it is applied.
Left and Top axis are at 0,0 positions.

Use with StartPosition and EndPosition properties to define the Axis position on a Chart.

You may use these properties with default and additional Axis, see the example below:

Example - Create a Custom Axis

Code: Select all

//Creates a new Vertical Axis and defines a position for it.

procedure TForm1.BitBtn2Click(Sender: TObject);
Var MyAxis : TChartAxis ;
begin
  MyAxis := TChartAxis.Create(  Chart1 );
  Series2.CustomVertAxis := MyAxis;

  //You can modify any property of the new created axes, such as the axis color or axis title
  With MyAxis do
  begin

    Axis.Color:=clGreen ;
    Title.Caption := 'Extra axis' ;
    Title.Font.Style:=[fsBold];
    Title.Angle := 90;
    PositionPercent := 20; //percentage of Chart rectangle

    StartPosition:=50;
    EndPosition:=100;
  end;
end;
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

HCLab
Newbie
Newbie
Posts: 9
Joined: Wed Jan 31, 2007 12:00 am

Re: Can I adjust TeeChart's y-axis like this attachment?

Post by HCLab » Tue Jul 14, 2009 10:21 am

Thank you very much
It was very useful comment :3

Post Reply