开发者

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

开发者 https://www.devze.com 2023-03-28 21:11 出处:网络
I\'am using jasperReport/ireport 4.0 Using jasper I generate a report contain barChart that contain a lot of informations,

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 rig开发者_JAVA技巧ht value

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

My chart:

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


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

verticalAxis.setStandardTickUnits(verticalTicks);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消