NumberAxis alignment of ticks to multiples of tickUnit

Adam Granger adam at
Wed Aug 20 06:38:16 UTC 2014

I've just been having fun with scrolling graphs in JavaFx. It seems that
when using Number axis without autoRanging graphs must always start with a
major tick, even if it is not a multiple of tickUnit.

For example a graph with xAxis range 4 to 24 and tickUnit 10. I would
expect major ticks at 10 and 20, however I see ticks at 4, 14 and 24 -
this feels weird. To me aligning tick marks to multiples makes sense and
should at least be a option, it's what you would have done in your Maths
when drawing graphs by hand.

 * my question:
 * another one I found later:

I "solved" this by subclassing ValueAxis - see my own answer on
stackoverflow link.

There is also a project called jfxutils which contains a class called
StableTickAxis which appears to do the same job along with duplicating a
lot of the functionality in NumberAxis.

So my question to the group is, would you consider including this
functionality in the main NumberAxis class? - obviously making it
configurable and defaulting to current behaviour.



More information about the openjfx-dev mailing list