chart-fx icon indicating copy to clipboard operation
chart-fx copied to clipboard

Log-scaled axis have wrong minor tick count by default

Open eltos opened this issue 7 months ago • 0 comments

Describe the bug

By default, log-scaled DefaultNumericAxis have 9 minor ticks where it should have 8. This can be seen in the LogAxisSample.java (screenshot taken from README):

DefaultNumericAxis yAxis = new DefaultNumericAxis();
yAxis.setLogAxis(true);

Image

Log-scaled axis should have 8 minor ticks:

Image

The problem is that minorTickCount defaults to 10 ("The number of actual minor tick marks will be one less than this") irrespective of the lin/log scale setting. See here.

One can work around this by explicitly setting the minorTickCount:

axis.setMinorTickCount(9); // actual number is one less

But ideally, and especially because this is the prime example given in the README, it should have a smarter default (9 or 10) depending on the lin/log setting when not explicitly overwritten by the user.

At the very least (poor-man solution) the example should be updated with the above workaround to point people to this unexpected behaviour.

To Reproduce

Environment:

  • OS: any
  • Java version: any
  • JavaFx version: any
  • ChartFx version: master

eltos avatar May 21 '25 15:05 eltos