Forum > TAChart

minimum interval [SOLVED]

(1/2) > >>

bbd666:
Hi all,
How to set a minimum value for the bottomaxis interval ?
For instance I want my chart to display intervals no lower than 1.
Thks for any reply.

wp:
In Laz 3.0, the axis Intervals.Options have a new element, apiInteger. When you add this, only integer values will be allowed for axis labels.

bbd666:
thks for your anwer
I'm using  Laz v2.2.4 :(
is it possible to upgrade with no loss in terms of configuation (packages and so on) ?

wp:
Depending whether your Lazarus source files are in a directory to which you can write this can be easy - or difficult. I looked at the git changelog when this feature was introduced, and you can easily make the following changes (if you are allowed to modify the source files):

* Go to folder components/tachart of your Lazarus installation
* Open file taintervalsources.pas in the IDE or an external editor
* Scroll down to the implementation of procedure TIntervalChartSource.CalculateIntervals
* Add the following highlighted code between the lines "bestCount := 0" and "if aipUseNiceSteps in Params.Options"
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  minCount, maxCount, bestCount: Integer;  s, sv: Double;begin  CalcMinMaxCount(minCount, maxCount);  bestCount := 0;  if aipInteger in Params.Options then begin    ABestStart := Int(AParams.FMin);    ABestStep := 1.0;    bestCount := Round(AParams.FMax) - round(ABestStart);    if bestCount <= maxCount then      exit;  end;  if aipUseNiceSteps in Params.Options then begin[...]
* Save
* Now open the unit tacustomsource.pas.
* Near the top there is the type declaration of TAxisIntervalParamOption.
* Before the closing bracket, add aipInteger. The entire type declaration now should be
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type  TAxisIntervalParamOption = (    aipGraphCoords,    aipUseCount, aipUseMaxLength, aipUseMinLength, aipUseNiceSteps,    aipInteger);
* Save
* Now recompile the IDE: In Lazarus, go to "Tools" > "Build Lazarus with profile ...". After a while the IDE restarts and you should be ready to go.Since there is always a chance that I forgot something so that the patch cannot be compiled with your version absolutely make a backup copy of the to-be-changed files before starting.

bbd666:
Great ! I'll try this.
Thks so much

Navigation

[0] Message Index

[#] Next page

Go to full version