Take the 2-minute tour ×

I'am using jasperReport/ireport 4.0

Using jasper I generate a report contain barChart that contain a lot of informations, The number on the x axis is not clear and precise ,from the chart I cant tell how many issue I have , when the user read the report he can't tell the right value

How can I minimise the scale to have more detailed number?

My chart:

enter image description here

share|improve this question

1 Answer 1

You'll need to use a chart customizer class to do this. Create a class that implements the JRChartCustomizer interface, then in the customize() method add the following code:

CategoryPlot plot = (CategoryPlot)jFreeChart.getPlot();
ValueAxis verticalAxis = plot.getRangeAxis();

TickUnits verticalTicks = new TickUnits();
verticalTicks.add(new NumberTickUnit(1));
verticalTicks.add(new NumberTickUnit(2));
verticalTicks.add(new NumberTickUnit(5));
verticalTicks.add(new NumberTickUnit(10));


The chart engine should always pick the smallest tick unit that does not cause the ticks to overlap. Using this code your chart should hopefully place ticks at every value or every 2 values.

share|improve this answer
Hello,thank you for the reply ,I'am generating this chart without coding using jasperReport and iReport ,I'am creating the chart using ireport and then I pass my parameter throw my code using jasperReport to the report –  rym Aug 18 '11 at 9:34
@rym: You do not need to create your chart programmatically, just set the 'Customizer Class' property of the chart in iReport. As long as your customizer class is on the classpath, the method will be called automatically during the report generation. All the other chart options will be just as you designed them in iReport. –  GenericJon Aug 18 '11 at 13:10

Your Answer


