Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linear DefaultNumericAxis doesn't round to tick units #675

Open
protogenes opened this issue Sep 19, 2024 · 0 comments
Open

linear DefaultNumericAxis doesn't round to tick units #675

protogenes opened this issue Sep 19, 2024 · 0 comments

Comments

@protogenes
Copy link
Contributor

Describe the bug
Using a linear DefaultNumericAxis and setting setAutoRangeRounding(true) will always round to the next best integer number instead of the tick unit.

final double minRounded = round ? axisTransform.getRoundedMinimumRange(min) : min;

LinearAxis doesn't have a transform and does the correct operation

minRounded = Math.floor(min / tickUnitRounded) * tickUnitRounded;

Is it necessary to pass the tick unit to getRoundedMaximumRange etc.?

To Reproduce

import io.fair_acc.chartfx.axes.spi.AxisRange
import io.fair_acc.chartfx.axes.spi.DefaultNumericAxis

var axis = new DefaultNumericAxis();
axis.setAutoRanging(true);
axis.setAutoRangeRounding(true);
var range = axis.autoRange(0.001, 0.002, 1000, 0)
assert range.getMax() < 0.002 + range.getTickUnit() : "Range max grew multiple tick units"

Environment:

  • OS: Win 10
  • Java version: 17.0.9
  • JavaFx version: 22.0.2
  • ChartFx version: 7908d4c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant