Axis values display is different betwen left and bottom axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Axis values display is different betwen left and bottom axis

Post by Verane » Thu Mar 04, 2004 10:21 am

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.

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Mar 04, 2004 10:46 am

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;

Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Post by Verane » Tue Aug 03, 2004 9:03 am

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.

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Aug 04, 2004 9:09 am

Hi Verane,

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

Verane
Newbie
Newbie
Posts: 23
Joined: Thu Jan 09, 2003 5:00 am

Post by Verane » Thu Aug 05, 2004 3:25 pm

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.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Aug 05, 2004 6:21 pm

Hi.

Yes, sending test application wold help a lot. You can send it to [email protected] email address.
Marjan Slatinek,
http://www.steema.com

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Aug 06, 2004 8:26 am

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.
Marjan Slatinek,
http://www.steema.com

Post Reply