Page 1 of 1

Maximum X Height of LeftAxis

Posted: Tue Dec 11, 2007 4:31 pm
by 4210526
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.

Posted: Tue Dec 11, 2007 6:43 pm
by narcis
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;

Posted: Wed Dec 12, 2007 7:40 am
by 4210526
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?

Posted: Wed Dec 12, 2007 9:42 am
by narcis
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.

Posted: Wed Dec 12, 2007 1:51 pm
by 4210526
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!

Posted: Wed Dec 12, 2007 2:30 pm
by narcis
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.

Posted: Thu Dec 13, 2007 9:48 am
by 4210526
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.

Posted: Thu Dec 13, 2007 11:23 am
by narcis
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));