[英]JFreeChart: how to move Y-axis from left to right hand side?
I use JFreeChart to create a candlestick chart.我使用 JFreeChart 创建烛台图。 The horizontal axis is a DateAxis to indicate the time, the vertical axis is a NumberAxis, to indicate the price.横轴是DateAxis,表示时间,纵轴是NumberAxis,表示价格。 As the screenshot shows, is the price axis shown on the left hand side of the chart.如屏幕截图所示,是图表左侧显示的价格轴。
I would like the vertical axis to be displayed on the right hand side of the chart, instead of the left hand side.我希望垂直轴显示在图表的右侧,而不是左侧。 I have been looking in the class overview for NumberAxis, ValueAxis and Axis classes in JFreeChart but could not find a method which can make this modification.我一直在查看 JFreeChart 中 NumberAxis、ValueAxis 和 Axis 类的 class 概述,但找不到可以进行此修改的方法。 Can somebody please show me how to make this change?有人可以告诉我如何进行此更改吗?
As shown here , you can use the XYPlot
method setRangeAxisLocation()
to set the location of the primary range axis.如此处所示,您可以使用XYPlot
方法setRangeAxisLocation()
来设置主要范围轴的位置。 The image below illustrates the effect of the following addition to this example :下图说明了在此示例中添加以下内容的效果:
chart.getXYPlot().setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.