Page 1 of 1

Axis values display is different betwen left and bottom axis

Posted: Thu Mar 04, 2004 10:21 am
by 8576839
Hi,

If I do the following things :
- put a new TeeChart (version 6.01 pro) on a form
- add a new point series to this TeeChart, with only two points which coordinates are (2, 2) and (5, 5)

When I execute my program and look at my chart, on the left axis I see a lot of axis values (2, 2.2, 2.4, 2.6, 2.8, 3, 3.2 ... 5) but on the bottom axis, I only see a few values (2, 3, 4 and 5). Why the two axis have not the same behaviour ?
How can I see more values on my bottom axis, especially after having doing a zoom (after a zoom, often I don't see any value on the bottom axis, whereas I see plenty of them on the left one) ?

Thank you for any help,
Verane.

Posted: Thu Mar 04, 2004 10:46 am
by Pep
Hi Verane,

>How can I see more values on my bottom axis, especially after having >doing a zoom (after a zoom, often I don't see any value on the bottom >axis, whereas I see plenty of them on the left one) ?
This can be changed setting an increment for the bottom axis like :
Chart1.Axes.bottom.Increment := 0.1;

Posted: Tue Aug 03, 2004 9:03 am
by 8576839
Hi,

I have tried to do what Pep suggested, but I still have some problems.
If I set an increment of 0.1, it is not precise enough when I zoom very deep. But If I put a smaller increment (0.001 for example), label values are overlaping on my bottom axis.
I think that what I need is that the increment adapts to the current zoom.
To achieve this, I tried to change the increment in the OnAfterDraw event with code like that :

procedure TForm1.FormCreate(Sender: TObject);
begin
Series2.Pointer.Style := psTriangle;
Series2.Pointer.HorizSize := 6;
Series2.Pointer.VertSize := 6;
Series2.Pointer.Pen.Color := clRed;
Series2.AddXY(2,2,'',clRed);
Series2.AddXY(3,3);
Series2.AddXY(4,4);
Series2.AddXY(5,5);

OrlandoChart1.OnAfterDraw := AfterDrawOrlandoChart;

With OrlandoChart1.BottomAxis do
begin
Automatic := False ;
Maximum:= 5 ;
Minimum:= 0 ;
end;
end;

procedure TForm1.AfterDrawOrlandoChart(Sender: TObject);
begin
With OrlandoChart1.BottomAxis do
begin
increment := (Maximum - Minimum) / 10;
end;
end;


The result is almost what I want except one thing :
if I zoom on my chart and then undo zoom (by double clicking on the chart) to go back to the largest scale, bottom axis label are overlaping a lot. If I then double click a second time, the scale does not change (it was already the largest possible), but the label overlap disappears.
I would like to have this result the first time I double click...

Is there something wrong in my code ? Or is this a bug of the teeChart ??
Is there another way to achieve what I want to do ??

Thank you by advance,
Verane.

Posted: Wed Aug 04, 2004 9:09 am
by Pep
Hi Verane,

which code are you using in the DblClick event ? Maybe is a repaint problem ?

Posted: Thu Aug 05, 2004 3:25 pm
by 8576839
Hi,

In fact we have herited the TChart to create a custom component. When doing a dbl click on this custom component, it is the same behaviour as doing a 'undozoom' with the mouse (by dragging the mouse from bottom right to up left).
So I have made the same test as described previously with a original TChart (and not our custom version), and instead of doing a dble click, I do a 'undozoom' as explained before.
I always see the same problem (overlaping on bottom axis).

Do you want me to send you a sample code to show you this ?
My project is very simple. Just a TChart and the code mentionned on my previous post.

Regards,
Verane.

Posted: Thu Aug 05, 2004 6:21 pm
by Marjan
Hi.

Yes, sending test application wold help a lot. You can send it to marjan@steema.com email address.

Posted: Fri Aug 06, 2004 8:26 am
by Marjan
I think the solution in your case is to use char OnUndoZoom event to reset axis scale. Something like this:

Code: Select all

 
procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
  with Chart1.BottomAxis do
  begin
    Automatic := False;
    Maximum := 5;
    Minimum := 0;
    Increment := 0.5;
  end;
end;

It also might be good idea to move the code from OnAfterDraw event to OnZoom event.