Gillius's Programming

March 2013 Archives

JFXUtils 0.3: Mousewheel Zooming -- March 15, 2013 10:13 PM

Version 0.3 of JFXUtils is released now, with only two real changes:

  1. Support for zooming with mousewheel. The location of the cursor is used as the "focal point" of zooming in or out. If cursor is on X or Y axis, only that axis is zoomed. ChartZoomManager allows drag zoom and wheel zoom to be enabled independently, by default both are on.
  2. Fix/workaround for auto-zooming in the charting example.

You can get it at the GitHub project page, or directly from the Gillius.org Maven Repository. You can also view documentation online.

I released version 0.2 of theĀ JFXUtils project I started recently, and now there is code for chart panning, and zooms are now animated. With panning and zooming working, I noticed that the default NumberAxis was not working at all how I would like. The tick positions remain in the same place no matter what the graph's bounds, and the values of the ticks then change to reflect the value. Well, with zooming and panning you will get for example a lower bound of "1432.34234", and this is exactly what NumberAxis will display. So, I created a replacement axis type called StableTicksAxis that keeps the ticks at the same data location for the given zoom level, which has a drastically better UI feel when the graph is changing rapidly during panning and zooming operations. It automatically computes the number and distance between tick marks based on the size of the graph, the graph label font, and the range of data displayed to maximize the number of tick marks without having the labels run into each other. When auto-ranging, it can force zero in the view like NumberAxis, and also like NumberAxis it can add some padding around the data, but unlike NumberAxis the amount of padding (as a percentage of graph size) is configurable.

« February 2013 | Main Index | Archives | February 2014 »