Martin
Martin

Reputation: 777

JFreechart X and Y axis scaling

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.

Upvotes: 3

Views: 4328

Answers (1)

GrahamA
GrahamA

Reputation: 5923

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));

Upvotes: 6

Related Questions