我想在我的报告中自定义我的图表(使用jasperReport和iReport 4.0),这个类最小化了比例,我怎样才能在每个条的顶部添加值并在X轴上垂直写出正确性,因为它们是重叠的(看看附图,这是一团糟)?
这是班级:
public class ChartCustomiser implements JRChartCustomizer{
@Override
public void customize(JFreeChart jfc, JRChart jrc) {
CategoryPlot plot = (CategoryPlot)jfc.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);
throw new UnsupportedOperationException("Not supported yet.");
}
}
我希望图表看起来像这样:
答案 0 :(得分:1)
你可以试试这个:
NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setVerticalTickLabels(true);