Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
minimum interval [SOLVED]
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
FPC 3.2.4, naming suggest...
by
dbannon
[
Today
at 06:31:58 am]
Amigo programming languag...
by
paxscript
[
Today
at 06:31:47 am]
What is a status of fpGUI...
by
Fred vS
[
Today
at 05:52:24 am]
Width of Project-Close D...
by
n7800
[
Today
at 04:30:10 am]
Artificial intelligence
by
zeljko
[
Today
at 01:46:06 am]
Spaces are allowed here ?
by
440bx
[
Today
at 12:59:39 am]
SDL2 image rotation Probl...
by
TRon
[
Today
at 12:39:30 am]
A Tip for beginners
by
dbannon
[January 18, 2025, 11:30:59 pm]
Looking For Lazarus Tutor...
by
cdbc
[January 18, 2025, 10:32:29 pm]
Fatal: Cannot find Contro...
by
Soner
[January 18, 2025, 09:58:44 pm]
Restoring minimized scree...
by
Soner
[January 18, 2025, 09:41:16 pm]
[SOLVED] SetPart ?
by
BubikolRamios
[January 18, 2025, 08:51:31 pm]
[SOLVED] Operators overri...
by
ackarwow
[January 18, 2025, 07:55:54 pm]
Programs writing programs...
by
MarkMLl
[January 18, 2025, 07:50:40 pm]
How to add new methods to...
by
jmpessoa
[January 18, 2025, 07:27:22 pm]
Preparing FPC 3.2.4, poin...
by
Fred vS
[January 18, 2025, 06:09:48 pm]
TSelectDirectoryDialog do...
by
krzynio
[January 18, 2025, 05:57:40 pm]
Iterator on non-existing ...
by
PascalDragon
[January 18, 2025, 05:08:52 pm]
const declaration
by
PascalDragon
[January 18, 2025, 05:05:55 pm]
How to avoid copying
by
PascalDragon
[January 18, 2025, 05:02:08 pm]
Nested declarations insid...
by
PascalDragon
[January 18, 2025, 04:57:51 pm]
TImage colors incorrect
by
Jonny
[January 18, 2025, 04:17:53 pm]
An interprocess network?
by
cdbc
[January 18, 2025, 03:10:31 pm]
INET TLUDPcomponent for i...
by
cdbc
[January 18, 2025, 03:08:38 pm]
Bug in the formula MATCH,...
by
veb86
[January 18, 2025, 02:40:23 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: minimum interval [SOLVED] (Read 1178 times)
bbd666
New Member
Posts: 14
minimum interval [SOLVED]
«
on:
February 27, 2024, 03:43:25 pm »
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.
«
Last Edit: February 28, 2024, 10:38:45 am by bbd666
»
Logged
wp
Hero Member
Posts: 12523
Re: minimum interval
«
Reply #1 on:
February 27, 2024, 04:12:20 pm »
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.
Logged
bbd666
New Member
Posts: 14
Re: minimum interval
«
Reply #2 on:
February 27, 2024, 04:22:02 pm »
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) ?
Logged
wp
Hero Member
Posts: 12523
Re: minimum interval
«
Reply #3 on:
February 27, 2024, 04:47:10 pm »
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
[Select]
[+]
[-]
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
[Select]
[+]
[-]
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.
Logged
bbd666
New Member
Posts: 14
Re: minimum interval
«
Reply #4 on:
February 27, 2024, 05:22:24 pm »
Great ! I'll try this.
Thks so much
Logged
bbd666
New Member
Posts: 14
Re: minimum interval
«
Reply #5 on:
February 28, 2024, 10:38:02 am »
That works fine !!!
Thank you very much, your instructions were crystal clear.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
minimum interval [SOLVED]
TinyPortal
© 2005-2018