简体   繁体   中英

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

I use JFreeChart to create a candlestick chart. The horizontal axis is a DateAxis to indicate the time, the vertical axis is a NumberAxis, to indicate the price. 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. 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. The image below illustrates the effect of the following addition to this example :

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

图片

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM