0

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.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • What happens when you change the `PlotOrientation`? – trashgod May 12 '22 at 12:21
  • When i change the plot orientation from vertical to horizontal then it changes the display of plots from vertical bars to horizontal bars .But i don't wanted to change the plot orientation ,only wanted to change the two horizontal labels and place them on Top Left and right – user15584948 May 12 '22 at 12:39
  • I tried vertical axis.setLabelRotationAngle() but it did not help me with the label on the right side..On left side to some extent i was able to move – user15584948 May 12 '22 at 12:40

1 Answers1

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

trashgod
  • 203,806
  • 29
  • 246
  • 1,045