本文介绍了使用Customiser Chart Class有哪些步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在报告中自定义我的图表(使用jasperReport和iReport 4.0),此类最小化比例,我如何在每个条形图的顶部添加值并在X轴上垂直写入正确性,因为它们是重叠的(看看附图,这是一团糟吗?
这是类:
公共类ChartCustomiser实现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);
抛出新的UnsupportedOperationException(尚不支持。);
}
}
我希望图表看起来像这样:
NumberAxis rangeAxis =(NumberAxis)plot.getRangeAxis ();
rangeAxis.setVerticalTickLabels(true);
I want to customised my charts in my reports (using jasperReport and iReport 4.0) ,this class minimise the scale ,how can I also add value on top of each bar and write the properity on X axis vertically because their are overlapping (look at the attach chart it's a mess)?
this is the class:
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.");
}
}
I want a chart look like this:
解决方案
you can try this:
NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setVerticalTickLabels(true);
这篇关于使用Customiser Chart Class有哪些步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 02:24