Page 1 of 1

Custom axis zoom

Posted: Thu Aug 10, 2006 7:47 pm
by 9790349
Hi,

I have several vertical Custom axes on my Chart. I found some code in your FAQ how to zoom custom axes.

It works fine when I zoom with Zoom tool (hold down left mouse button and select a rectangle), but it do not work when I Zoom with the following code:

Code: Select all

MyChart.Zoom.ZoomPercent( 110 );
I used the following code to zoom my custom axes:

Code: Select all

procedure TUserControl.TChart_Felso_Zoomed(sender: System.Object; e: System.EventArgs);
var
  I: Integer;
  ax : Steema.TeeChart.Axis;
begin
  for I := 0 to TChart_Felso.Axes.Custom.Count - 1 do
  begin
    ax := TChart_Felso.Axes.Custom[ i ];
    with ax do
    begin
      Debug.Write( 'y1 = ' + TChart_Felso.Zoom.y1.ToString);
      Debug.Write( 'y0 = ' + TChart_Felso.Zoom.y0.ToString );
      SetMinMax( CalcPosPoint( TChart_Felso.Zoom.y1 ),
                 CalcPosPoint( TChart_Felso.Zoom.y0 )
      );
    end;
  end;
end;
Best regards,

Gabor Varga

Posted: Fri Aug 11, 2006 7:05 am
by Chris
Hello,

Instead of using the ZoomPercent method you should use the Axis.SetMinMax method. Internally this is what ZoomPercent does anyway.

Posted: Fri Aug 11, 2006 1:47 pm
by 9790349
Hi,

It is not clear for me, could you reproduce the problem?

Yes, I can use SetMinMax, but then I have to care about preserve original zoom values except using Zoom.Undo.

Best regards,

Gabor Varga

Posted: Fri Aug 11, 2006 2:00 pm
by Chris
Hello,

Automatic zoom is not available for custom axes. You have to code the zoom manually using SetMinMax which may include saving the old MinMax values in a variable to undo the 'zoom' at a later moment.