JFreeChart:如何将 Y 轴从左侧移动到右侧?

JFreeChart: how to move Y-axis from left to right hand side?

我使用 JFreeChart 创建烛台图表。横轴是 DateAxis,表示时间,纵轴是 NumberAxis,表示价格。如屏幕截图所示,价格轴显示在图表的左侧。

我希望垂直轴显示在图表的右侧,而不是左侧。我一直在查看 JFreeChart 中 NumberAxis、ValueAxis 和 Axis classes 的 class 概述,但找不到可以进行此修改的方法。 有人可以告诉我如何进行此更改吗?

如图here, you can use the XYPlot method setRangeAxisLocation() to set the location of the primary range axis. The image below illustrates the effect of the following addition to this example:

chart.getXYPlot().setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);