Search code examples
graphchartsjfreechartspacing

Spacing Between Multiple X-Axes in JFreeChart


I'm attempting to try and increase the vertical spacing between multiple x-axes using JFreeChart. Currently, my charts look like this:

Current chart

However, I need to produce something like the following so that the x-axes are more clearly defined (note that the vertical spacing between the x-axes is larger than in the first image):

Desired chart

Does any one have any idea on how to do this? I've been searching the JFreeChart API for > 2 days now and can't find anything that directly addresses the issue other than attempting to use org.jfree.chart.axis.AxisSpace in some way.

Many thanks for any help!


Solution

  • One approach would be to customise the axis label insets (that is, increase the space below each axis label).

    http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/Axis.html#setLabelInsets-org.jfree.ui.RectangleInsets-