JFreechart X和Y轴缩放
问题描述:
是否可以在jfreechart中设置轴刻度值? 例如,我想要X轴比例尺10和Y轴比例尺1.
It's possible to set the axis scale values in jfreechart? For example, I'd want X-axis scale 10 and Y-Axis scale 1.
答
如果您使用的是XYPlot
,请设置TickUnit
You set the TickUnit
, if you are using an XYPlot
try this
XYPlot plot = chart.getXYPlot();
NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
xAxis.setTickUnit(new NumberTickUnit(10));
NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setTickUnit(new NumberTickUnit(1));