Hi,
how do I control the number of divisions on either axis.
For eg. I have an axis ranging from 0-300. I want only 3 major divisions.
for e.g 0,100,200,300
The default chart comes up with 0,25,50 etc..,
Do i have play with the 'ticks' to acheive this??
Thanks,
Molly.
Divisions on Axes
Re: Divisions on Axes
Hi Molly,
You need to set a tick unit with size = 100, something like this:
XYPlot plot = myChart.getXYPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setTickUnit(new NumberTickUnit(100.0));
Regards,
Dave Gilbert
You need to set a tick unit with size = 100, something like this:
XYPlot plot = myChart.getXYPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setTickUnit(new NumberTickUnit(100.0));
Regards,
Dave Gilbert
Re: Divisions on Axes
Thanks, Dave. The constructor for the NumberTickUnit also takes the format.
axis.setTickUnit(new NumberTickUnit(100.0,new DecimalFormat("###.#"));
Thanks,
Molly.
axis.setTickUnit(new NumberTickUnit(100.0,new DecimalFormat("###.#"));
Thanks,
Molly.