Page 1 of 1

what does AdjustMaxMin and CalcMinMax do?

Posted: Wed Apr 19, 2006 1:21 am
by 9234539
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

Posted: Wed Apr 19, 2006 8:34 am
by narcis
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.

Posted: Wed Apr 19, 2006 11:49 am
by 9234539
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?

Posted: Mon Apr 24, 2006 11:02 am
by Pep
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;