Maximum X Height of LeftAxis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
AchatSolutions
Newbie
Newbie
Posts: 20
Joined: Wed Jul 11, 2001 4:00 am
Location: Bavaria
Contact:

Maximum X Height of LeftAxis

Post by AchatSolutions » Tue Dec 11, 2007 4:31 pm

Hello support team,

i would like to increment the maximum x value of the leftaxis.
LeftAxis maximum is set to automatic.

When all bars added to the chart i would like to increment the leftaxis with 10% of there size.

Example:
Maximum = 1000
Increment = 100

New maximum = 1100

How can i realize that?

Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Dec 11, 2007 6:43 pm

Hi AchatSolutions,

You have 2 options:

1. Manually setting axis maximum like this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 10 do
    Series1.Add(i*100);

  Chart1.Axes.Left.Increment:=100;
  Chart1.Axes.Left.AutomaticMaximum:=false;
  Chart1.Axes.Left.Maximum:=Series1.MaxYValue*1.1;
end;
2. Using MaximumOffset property, for example:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 10 do
    Series1.Add(i*100);

  Chart1.Axes.Left.Increment:=100;

  Chart1.Draw;
  Chart1.Axes.Left.MaximumOffset:=Chart1.Axes.Left.IAxisSize div 10;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AchatSolutions
Newbie
Newbie
Posts: 20
Joined: Wed Jul 11, 2001 4:00 am
Location: Bavaria
Contact:

Post by AchatSolutions » Wed Dec 12, 2007 7:40 am

Thanks for that. I am sorry for my bad description... so i am trying to explain it one more time:

Heres an screenshot that demonstrates my problem:
Image
Big version

As you can see in this screenshot the first bar with its mark is out of the chart box. So the left axis is set to 3000. But i would like that the maximum is 10 percent higher. So the mark will be completly in the chart box. Thats the reason why i would like to increment the left axis maximum.

I am using delphi 6 and teechart pro 5.02.


So how can i do this?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 12, 2007 9:42 am

Hi AchatSolutions,

The code I posted does exactly what you request. Which exact problem are you having with your TeeChart version? You may need to replace Axes.Left for LeftAxis.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AchatSolutions
Newbie
Newbie
Posts: 20
Joined: Wed Jul 11, 2001 4:00 am
Location: Bavaria
Contact:

Post by AchatSolutions » Wed Dec 12, 2007 1:51 pm

I have tried it one more time:

1. solution:

Code: Select all

Chart.Increment :=100;
doesn' affect to the maximum size of the grid. Only the displayed steps in the left axis changed to 100. And i dont know the highest bar of my chart. So i cant use this solution.

2. solution: The function

Code: Select all

Chart.Axes.Left.MaximumOffset
doesnt exist in my version.

I am sorry, hope you can help me one more time.

Thanks!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 12, 2007 2:30 pm

Hi AchatSolutions,

The code below works fine for me here using v5.03.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
        for i:=0 to 10 do
                Series1.Add(i*100);

        Chart1.LeftAxis.Increment:=100;
        Chart1.LeftAxis.AutomaticMaximum:=false;
        Chart1.LeftAxis.Maximum := Series1.MaxYValue * 1.1;
end;
Please notice that Increment property belongs to the axes not to the chart. Regarding MaximumOffset, it's not supported in v5, it was implemented in later versions, current version is number 8.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AchatSolutions
Newbie
Newbie
Posts: 20
Joined: Wed Jul 11, 2001 4:00 am
Location: Bavaria
Contact:

Post by AchatSolutions » Thu Dec 13, 2007 9:48 am

Thanks, but his line does not work:

Code: Select all

Chart1.LeftAxis.Maximum := Series1.MaxYValue * 1.1; 
Thats because i have several bar series. And i dont know which one is the highest.

Id like to check out whats the highest point of the chart and then add 10 % to this value. So all marks will be in the chart box and i can print it.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Dec 13, 2007 11:23 am

Hi AchatSolutions,

In that case the easiest solution would be letting left axis doing this calculation for you, for example:

Code: Select all

  Chart1.LeftAxis.SetMinMax(0,1000);
  Caption:=FloatToStr(Chart1.MaxYValue(Chart1.LeftAxis));
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply