开发者

JfreeChart: Scatter Plot moving X and Y Axises

开发者 https://www.devze.com 2023-01-27 01:14 出处:网络
I just started using JFreeChart lib. I have a XY scatter chart with some negative plot points. The X and Y axises stay at the bottom and left sides of the chart, and they intercept at negative values.

I just started using JFreeChart lib. I have a XY scatter chart with some negative plot points. The X and Y axises stay at the bottom and left sides of the chart, and they intercept at negative values. How can I make these axises intercept at (0,0) instead of intercepting at nega开发者_运维百科tive values? Thanks in advance.


A scatter plot uses an XYPlot and a NumberAxis for the domain and range. You can get each axis from the plot and invoke setLowerBound(), accordingly.

XYPlot plot = (XYPlot) chart.getPlot();
NumberAxis domainAxis = (NumberAxis) plot.getRangeAxis();
domainAxis.setLowerBound(0);
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setLowerBound(0);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号