'Position x axis labels on top left and right

I have a dual axis jfreechart which has two x axis. By default the axis labels are appearing horizontally, I wanted to display them at the top left and right.



Solution 1:[1]

To move the axis label, you can specify the desired AxisLabelLocation. As the default is AxisLabelLocation.MIDDLE, you can move it to the left using LOW_END like this:

xAxis1.setLabelLocation(AxisLabelLocation.LOW_END);
xAxis2.setLabelLocation(AxisLabelLocation.LOW_END);

The effect is illustrated here.

image1

You can also change the AxisLocation as shown here.

image2

As an aside, you can alter the label's text attributes as shown here.

image3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1