JFreeChart - how to reverse axis order
Asked Answered
G

2

7

I'm creating XYPlot and I need to reverse the order on y-Axis (that is, I need lower numbers to be higher on the axis). I would appreciate any hints how to do that.

Glasser answered 1/11, 2011 at 18:42 Comment(0)
A
11

I had the same problem as you. I found this:

ChartPanel.getChart().getXYPlot().getRangeAxis().setInverted(boolean)
Augean answered 2/11, 2011 at 11:42 Comment(1)
I found it: if(CP.getChart().getXYPlot().getDomainAxis().isInverted()) { CP.getChart().getXYPlot().getDomainAxis().setInverted(false); } else { CP.getChart().getXYPlot().getDomainAxis().setInverted(true); }Josiejosler
N
1

to reverse the Y-axis ... you can use

ChartPanel.getChart().getXYPlot().getDomainAxis().setInverted(boolean) 

Source: Reverse X-axis numeric labels in JFreeChart

Nauru answered 18/2, 2014 at 6:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.