What are the steps to use Customiser Chart Class?

允我心安 提交于 2019-12-13 02:04:14

问题


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:


回答1:


you can try this:

NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setVerticalTickLabels(true);


来源:https://stackoverflow.com/questions/7173261/what-are-the-steps-to-use-customiser-chart-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!