Hi,
I want to do a template to output a pdf with a bar chart. Each column of this chart is a field of my model (with just a single series). My problem is I don't know how I do this. I already try to search, bt everywhere are for mutiple series, for list or for table of database.
Can someone tell me how I do this. I'm very new to Jasper.
My model (the chart fields, where each field is a bar value)
public class Report { private Double f1; private Double f2; private Double f3; public Double getF1(){ return f1; } public Double getF2(){ return f2; } public Double getF3(){ return f3; } }
To compile and generating the PDF:
Report report = getSelectedReport(); HashMap<String, Object> parameters = new HashMap<>(); parameters.put("dataChart", report); JasperReport jasperReport = JasperCompileManager.compileReport(reportSrcFile); ArrayList<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>(); list.add(parameters); JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(list); JasperPrint print = JasperFillManager.fillReport(jasperReport, null, beanColDataSource);
0 Answers:
No answers yet