Help: where is BarPlot class???

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
charlotte

Help: where is BarPlot class???

Post by charlotte » Wed Apr 17, 2002 10:30 am

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.

David Gilbert

Re: Help: where is BarPlot class???

Post by David Gilbert » Wed Apr 17, 2002 11:35 am

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.

charlotte

Re: Help: where is BarPlot class???

Post by charlotte » Wed Apr 17, 2002 2:15 pm

thanks a lot, it works.

Charlotte.

Locked