Guest User

Untitled

a guest
Oct 15th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. public static JFreeChart createChart(String title, List <Result> results){
  2.  
  3. DefaultPieDataset pieDataset = new DefaultPieDataset();
  4.  
  5. Iterator<Result> itr = results.iterator();
  6.  
  7. while (itr.hasNext()) {
  8. Result result = itr.next();
  9. String itemName = result.getItemName();
  10. BigDecimal itemResult = result.getItemResult();
  11. pieDataset.setValue(itemName, itemResult);
  12. }
  13.  
  14. JFreeChart chart = null;
  15.  
  16. try {
  17. chart = ChartFactory.createPieChart(title, pieDataset,true, false, false);
  18.  
  19. } catch (Exception e) {
  20. log.error("Threw a ParseException in createChart:, full message:",
  21. e);
  22. }
  23.  
  24. return chart;
  25. }
  26.  
  27. ((PiePlot) chart.getPlot()).setLabelGenerator(null);
Add Comment
Please, Sign In to add comment