hi everybody,
i want to create a VerticalBarChart and to have only Integer on the Axis, i think i have to do smthing like that:
JFreeChart chart = ChartFactory.createVerticalBarChart("titre", null, null, dataset, false);
BarPlot plot = (BarPlot)myChart.getPlot();
NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
TickUnits integerTicks = TickUnits.createIntegerTickUnits();
rangeAxis.setStandardTickUnits(integerTicks);
but the compiler can't find BarPlot class... neither do i...
thank for help!
Charlotte.
Help: where is BarPlot class???
Re: Help: where is BarPlot class???
The code has changed a little in the latest version. The BarPlot class is no longer required, as the CategoryPlot class plus the VerticalBarRenderer serve the same function. So you can use the following:
// create the chart...
JFreeChart chart = ChartFactory.createVerticalBarChart(...whatever...);
// get a reference to the plot for further customisation...
CategoryPlot plot = chart.getCategoryPlot();
// change the auto tick unit selection to integer units only...
NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setStandardTickUnits(TickUnits.createIntegerTickUnits());
Regards,
DG.
// create the chart...
JFreeChart chart = ChartFactory.createVerticalBarChart(...whatever...);
// get a reference to the plot for further customisation...
CategoryPlot plot = chart.getCategoryPlot();
// change the auto tick unit selection to integer units only...
NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setStandardTickUnits(TickUnits.createIntegerTickUnits());
Regards,
DG.