Zoom changes left axis property

TeeChart for ActiveX, COM and ASP
Post Reply
PascalL
Newbie
Newbie
Posts: 13
Joined: Mon May 15, 2006 12:00 am

Zoom changes left axis property

Post by PascalL » Wed Jan 18, 2012 9:13 am

HI,
I am using TeeChart AX 2011.0.5 with custom axis and line series. The left axis is configured as Automatic for min and max values: as it is a percentage, the current range of values is 0..100. When the user zooms a series, the automatic properties of the left axis is deselected, the min value is changed to an high value not in the range e.g. 323.55 and the same thing happens to the max value. Is there any idea to avoid such behaviour?
Pascal

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zoom changes left axis property

Post by Yeray » Wed Jan 18, 2012 4:10 pm

Hi Pascal,

I'm not sure to understand what'd the exact configuration of your chart. Could you please arrange a simple example project we can runa s-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

PascalL
Newbie
Newbie
Posts: 13
Joined: Mon May 15, 2006 12:00 am

Re: Zoom changes left axis property

Post by PascalL » Wed Jan 18, 2012 4:22 pm

Well, it is a little bit complicated because the chart is integrated in a solution with a database. May I send you a doc containing screen copies?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zoom changes left axis property

Post by Yeray » Thu Jan 19, 2012 9:14 am

Hi Pascal,

Yes, some screen-shots may help us to understand the situation. However, sometimes this is not enough and we have to insist on getting a simple project :-S
You can attach your files directly here in the forums if you find it acceptable.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

PascalL
Newbie
Newbie
Posts: 13
Joined: Mon May 15, 2006 12:00 am

Re: Zoom changes left axis property

Post by PascalL » Thu Jan 19, 2012 10:27 am

Hi Yeray,

I attached the screen copy of the Editor values before and after the 'user' has zoomed the chart.

How to understand these screen copies:
The first page of the document shows the initial values of the Editor after the chart is displayed. The customer uses the mouse to zoom a part of the chart.
The second the and third pages show that Left axis configuration changed after the user zoom.

Pascal
Attachments
TeeChart v2011.0.5 - Zoom change Left Axis properties.zip
(54.47 KiB) Downloaded 825 times

PascalL
Newbie
Newbie
Posts: 13
Joined: Mon May 15, 2006 12:00 am

Re: Zoom changes left axis property

Post by PascalL » Thu Jan 19, 2012 10:59 am

I upgrade the screen copies to show the chart before and after the zoom, from the solution.
Best regards,
Pascal
Attachments
TeeChart v2011.0.5 - Zoom change Left Axis properties-Ed2.zip
(164.78 KiB) Downloaded 883 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Zoom changes left axis property

Post by Yeray » Thu Jan 19, 2012 2:24 pm

Bonjour Pascal,

The top three vertical axes are custom axes and the last vertical axis, the signalized in red, is the default left axis. With it, I guess the zoom rectangle you drew with the mouse is something similar to the blue rectangle in the picture below. Am I right?
axes.png
axes.png (267.55 KiB) Viewed 12235 times
Note that only the default axes (left, right, bottom, top) zoom automatically. That's why the three vertical axes on top aren't rescaled when you zoom.
And the same reason explains why the left axis takes (322.632, 395.789) as new scale. You are probably drawing the zoom rectangle where these values would be if the left axis was larger. An image usually explains more than thousand words:
left axis.png
left axis.png (273.73 KiB) Viewed 12246 times
So, when you are drawing a zoom rectangle on the blue area, you are actually telling the left axis you want it to be rescaled to 322, 395. But there is no point in that scale for the pink series.. so nothing is shown.

You can draw a zoom rectangle anywhere in the ChartRect, but only the default axes are going to be rescaled by default. It doesn't matter if the default axes aren't defining the same zone.

Here it is a simple example trying to simulate the behaviour you are experiencing:

Code: Select all

uses Series;

const nSeries = 4;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=false;
  Chart1.MarginLeft:=7;

  for i:=0 to nSeries-1 do
  begin
    Chart1.AddSeries(TFastLineSeries);
    Chart1[i].FillSampleValues();

    if i = nSeries-1 then
    begin
      with Chart1.Axes.Left do
      begin
        StartPosition:=(100/nSeries)*i;
        EndPosition:=(100/nSeries)*(i+1);
        Axis.Color:=Chart1[i].Color;
      end;
    end
    else
    begin
      Chart1.CustomAxes.Add;
      Chart1[i].CustomVertAxis:=Chart1.CustomAxes[i];
      with Chart1.CustomAxes[i] do
      begin
        StartPosition:=(100/nSeries)*i;
        EndPosition:=(100/nSeries)*(i+1);
        Axis.Color:=Chart1[i].Color;
      end;
    end;
  end;
end;
Now, if you only want to zoom horizontally and force all the vertical axes to maintain their initial scale you have two options:
1) Set the zoom direction to be horizontal so the default left axis won't zoom either:

Code: Select all

  Chart1.Zoom.Direction:=tzdHorizontal;
2) Use another custom axis instead of the default left axis:

Code: Select all

uses Series;

const nSeries = 4;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=false;
  Chart1.MarginLeft:=7;

  for i:=0 to nSeries-1 do
  begin
    Chart1.AddSeries(TFastLineSeries);
    Chart1[i].FillSampleValues();
    Chart1.CustomAxes.Add;
    Chart1[i].CustomVertAxis:=Chart1.CustomAxes[i];
    with Chart1.CustomAxes[i] do
    begin
      StartPosition:=(100/nSeries)*i;
      EndPosition:=(100/nSeries)*(i+1);
      Axis.Color:=Chart1[i].Color;
    end;
  end;

//  Chart1.Zoom.Direction:=tzdHorizontal;
end;
If the behaviour you'd expect isn't the above, please don't hesitate to let us know.

À bientôt! ;)
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply