Zoom and Automatic Axes

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
jhhd
Newbie
Newbie
Posts: 17
Joined: Tue Mar 09, 2004 5:00 am

Zoom and Automatic Axes

Post by jhhd » Fri Aug 22, 2008 2:20 pm

Am I correct in thinking that zooming causes LeftAxis->Automatic to become false, and unzooming causes it to become true?

If this is the case, is there any way to have its value after zooming the same as is before zooming?

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

Post by Pep » Fri Aug 22, 2008 3:26 pm

> Am I correct in thinking that zooming causes LeftAxis->Automatic to become false, and unzooming causes it to become true?
Yes, you're correct.

> If this is the case, is there any way to have its value after zooming the same as is before zooming?
Here you can find a solution.

jhhd
Newbie
Newbie
Posts: 17
Joined: Tue Mar 09, 2004 5:00 am

Post by jhhd » Fri Aug 22, 2008 3:53 pm

Let me explain my situation a little more:

I have a chart with 12 y-axes: the default Left and Right axes, and ten custom axes. I have zoom set to horizontal so that you can only zoom the x-axes. I have implemented zoom memory so that when you zoom in it remembers the position of the zoom, and when you zoom out it zooms to the previous zoom area. I also have a custom chart options form which allows you to adjust axis settings, including Min/Max and whether it's Automatic or not.

If automatic is set to false, and a Min/Max is entered, all behaves perfectly. The issue is when automatic is set to true: on all but the LeftAxis and RightAxis, zooming and unzooming causes the axis min/max to scale perfectly with the visible data. For the LeftAxis and the RightAxis, however, zooming in sets the automatic property to false. This causes the axis to stop updating. When you unzoom it sets it back to true, causing it to update as required. As the unzooming is done with a memory, however, it will behave something like this:

Code: Select all

Start   : Min: 0;  Max: 100 [data min: 0;  data max: 100]
Zoom In : Min: 0;  Max: 100 [data min: 20; data max: 80]
Zoom In : Min: 0;  Max: 100 [data min: 40; data max: 60]
Zoom Out: Min: 20; Max: 80  [data min: 20; data max: 80]
Zoom Out: Min: 0;  Max: 100 [data min: 0;  data max: 100]
What I want to achieve is that if you zoom in, when automatic is true, it will remain set to true and fit to the data. If you zoom in when automatic is false, it will remain set to false.

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

Post by Narcís » Mon Aug 25, 2008 10:21 am

Hi jhhd,
What I want to achieve is that if you zoom in, when automatic is true, it will remain set to true and fit to the data. If you zoom in when automatic is false, it will remain set to false.
This works fine for me here using code below. Could you please check if it works fine at your end and let us know the exact TeeChart version you are using?

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Axes.Left.SetMinMax(0,100);
  Chart1.Axes.Bottom.SetMinMax(0,100);
end;

procedure TForm1.Chart1Zoom(Sender: TObject);
begin
  Caption:=BoolToStr(Chart1.Axes.Left.Automatic) + ', ' +
            BoolToStr(Chart1.Axes.Bottom.Automatic);
end;

procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
  Caption:=BoolToStr(Chart1.Axes.Left.Automatic) + ', ' +
            BoolToStr(Chart1.Axes.Bottom.Automatic);
end;
Thanks in advance.
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