0

I have just started using JFreeChart, so this might be a naive question.

I have a requirement where I want to reverse the order of X-axis labels while generating the chart (XYLineChart). Could someone tell me how can this be done using JFreeChart API ?

For example, as of now my X-axis labels are in ascending order : {1,2,3,4,5} say. I want the X-axis labels to be shown in the descending order : {5,4,3,2,1}. Needless to say, it should also change the corresponding Y values accordingly while displaying.

Thanks.

invinc4u
  • 1,125
  • 3
  • 15
  • 26
  • 2
    Possible duplicate of [JFreeChart - how to reverse axis order](http://stackoverflow.com/questions/7971264/jfreechart-how-to-reverse-axis-order) – trashgod Mar 16 '13 at 12:22
  • 2
    Thanks for the link @trashgod. Though the linked question was not the exact solution, but it gave me hints on how to solve this problem. The linked question re-orders the Y-axis in reversed order using : ChartPanel.getChart().getXYPlot().getRangeAxis().setInverted(boolean). For reversing the X-axis , this did the trick for me : ChartPanel.getChart().getXYPlot().getDomainAxis().setInverted(boolean) . Thanks for your help. Appreciate it !! – invinc4u Mar 17 '13 at 07:36

0 Answers0