what does AdjustMaxMin and CalcMinMax do?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

what does AdjustMaxMin and CalcMinMax do?

Post by Fang » Wed Apr 19, 2006 1:21 am

hi,
I can't make AdjustMaxMin and CalcMinMax for axis work. The first one doesn't resize the axis, the latter one doesn't give me the correct min max.

So normally how do I get the new min max after I changed the series value manually?

Automatic is false.

Thanks.
v7.06

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

Post by Narcís » Wed Apr 19, 2006 8:34 am

Hi Fang,

AdjustMaxMin:

This Axis method calculates Maximum and Minimum values based on Max and Min values of the dependent Series.

AdjustMaxMin is automatically called if Axis.Automatic is True.

The Chart UndoZoom method calls AdjustMaxMin for Left, Right,Top and Bottom axis.<


To set axes minimum and maximum values you should use SetMinMax mehtod.


CalcMinMax:

Returns the minimum and maximum values of the associated Series.

If this doesn't fit your needs you can use series MaxXValue, MinXValue, MaxYValue and MinYValue or Axes Minimum and Maximum properties.
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

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Wed Apr 19, 2006 11:49 am

The reason I am asking this is that by description it seems I can call AdjustMinMax at most of times to resize the axis, right?

But it seems like to me it doesn't work when automatic is false, but when automatic is true, you know I don't need AdjustMinMax, so is this a internal function or bug?

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

Post by Pep » Mon Apr 24, 2006 11:02 am

Hi Fang,

using Axis automatic to False you should be able to use the AdjustMaxMin method using similar code like the following :

Code: Select all

procedure AdjustAxis(Series: TChartSeries);
begin
  if Assigned(Series) and Assigned(Series.GetHorizAxis) then
  begin
      Series.GetHorizAxis.SetMinMax(0,Series.Count-1);
      Series.GetHorizAxis.AdjustMaxMin;
  end;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  Chart1.Repaint;
  AdjustAxis(Series1);
end;

Post Reply