When I enable the mouse wheel zoom in my chart using this code line:
chartPanel.setMouseWheelEnabled(true);
Scrolling the mouse wheel will zoom in/out both x and y axis. How can I disable mouse wheel zooming on one of the axis?
Jfreechart Version: 1.0.13
Use the ChartPanel
methods setDomainZoomable()
and setRangeZoomable()
to control the axes individually. As a concrete example, edit createChartPanel()
in this example as follows to enable zoom on the "Value"
axis, while leaving the "Count"
axis unchanged:
panel.setMouseWheelEnabled(true);
panel.setDomainZoomable(true);
panel.setRangeZoomable(false);
For convenience,
Use the context menu to change the zoom settings as needed.
Use zoom buttons such as these as needed.
Use other applicable features described here.