mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:59:13 +02:00
TAChart: Add aipInteger as new TAxisIntervalParamOption to force axis labels only in integer steps.
This commit is contained in:
parent
3a8bac2cfd
commit
9ac4a95870
@ -23,7 +23,8 @@ uses
|
|||||||
type
|
type
|
||||||
TAxisIntervalParamOption = (
|
TAxisIntervalParamOption = (
|
||||||
aipGraphCoords,
|
aipGraphCoords,
|
||||||
aipUseCount, aipUseMaxLength, aipUseMinLength, aipUseNiceSteps);
|
aipUseCount, aipUseMaxLength, aipUseMinLength, aipUseNiceSteps,
|
||||||
|
aipInteger);
|
||||||
|
|
||||||
const
|
const
|
||||||
DEF_INTERVAL_STEPS = '0.2|0.5|1.0';
|
DEF_INTERVAL_STEPS = '0.2|0.5|1.0';
|
||||||
|
@ -329,6 +329,13 @@ var
|
|||||||
begin
|
begin
|
||||||
CalcMinMaxCount(minCount, maxCount);
|
CalcMinMaxCount(minCount, maxCount);
|
||||||
bestCount := 0;
|
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
|
if aipUseNiceSteps in Params.Options then begin
|
||||||
s := AParams.CountToStep(minCount) * 10;
|
s := AParams.CountToStep(minCount) * 10;
|
||||||
while s >= Max(AParams.CountToStep(maxCount), AParams.FMinStep) do begin
|
while s >= Max(AParams.CountToStep(maxCount), AParams.FMinStep) do begin
|
||||||
@ -339,7 +346,10 @@ begin
|
|||||||
s *= 0.1;
|
s *= 0.1;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if bestCount > 0 then exit;
|
if (aipInteger in Params.Options) and (bestCount > maxCount) then
|
||||||
|
bestCount := 0;
|
||||||
|
if bestCount > 0 then
|
||||||
|
exit;
|
||||||
// Either nice steps were not required, or we failed to find one.
|
// Either nice steps were not required, or we failed to find one.
|
||||||
if aipUseCount in Params.Options then
|
if aipUseCount in Params.Options then
|
||||||
bestCount := EnsureRange(Params.Count, minCount, maxCount)
|
bestCount := EnsureRange(Params.Count, minCount, maxCount)
|
||||||
|
Loading…
Reference in New Issue
Block a user