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.

BeataS
  • 73
  • 1
  • 3

2 Answers2

11

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

ChartPanel.getChart().getXYPlot().getRangeAxis().setInverted(boolean)
Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207
  • I found it: `if(CP.getChart().getXYPlot().getDomainAxis().isInverted()) { CP.getChart().getXYPlot().getDomainAxis().setInverted(false); } else { CP.getChart().getXYPlot().getDomainAxis().setInverted(true); }` – Apopei Andrei Ionut Aug 30 '13 at 04:48
1

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

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

Source: Reverse X-axis numeric labels in JFreeChart

Community
  • 1
  • 1