Author Topic: TChartAxis.SetMinMax  (Read 2174 times)


  • New member
  • *
  • Posts: 6
« on: September 23, 2018, 01:58:16 pm »
I'm migrating from Delphi.
In Lazarus, TChartAxis does not have the SetMinMax method. In the TAChartTeeChart unit, I completed TChartAxisTeeChart class helper with the SetMinMax (Const AMin, AMax: Double); How to write this procedure refering to TChartAxis?


  • Hero Member
  • *****
  • Posts: 8108
Re: TChartAxis.SetMinMax
« Reply #1 on: September 23, 2018, 05:02:32 pm »
I must confess that I am not so well-experienced with TeeChart to understand what exactly TChartAxis.SetMaxMin does, in particular when several axes are overlayed.

In the simplest case of standard axes you can adapt the Chart.Extent to force fixed axis limits (see also
Code: Pascal  [Select][+][-]
  1.   Chart1.Extent.XMax := 1000;
  2.   Chart1.Extent.XMin := -1000;
  3.   Chart1.Extent.UseXMin := true;
  4.   Chart1.Extent.UseXMax := true;
  5.   // Similarly for y axis
Only when no axis transformations are involved then the values passed to .XMax, .XMin, .YMax, .YMin are in the units of the data ("axis units"). Otherwise the transformed values ("graph units") must be used. Suppose you have a (decadic) logarithmic axis, and you want to freeze the x axis limits at 1 to 1000, then you must specify .XMin to be 0 (because it is the log of 1) and .XMax to be 3 (because it is the log of 1000).
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...


TinyPortal © 2005-2018