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);
精彩评论