JFreechart X和Y轴缩放

Mar*_*tin 2 java jfreechart scale

可以在jfreechart中设置轴刻度值吗?例如,我想要X轴刻度10和Y轴刻度1.

Gra*_*amA 5

你设置了TickUnit,如果你正在XYPlot尝试这个

XYPlot plot = chart.getXYPlot();
NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
xAxis.setTickUnit(new NumberTickUnit(10));

NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setTickUnit(new NumberTickUnit(1));
Run Code Online (Sandbox Code Playgroud)