ajpcm1 Posted October 6, 2018 Share Posted October 6, 2018 I'm trying to do a report in Jasper and I want a bar chart. As parameter I have an object that contains a list of objects (label/value) that I want to do the chart. The problem is I don't know how I plot the chart with this list. For example:I have the following object: public class ChartField { private String name; private double value; public ChartField(String name, double value) { this.name = name; this.value = value; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getValue() { return value; } public void setValue(double value) { this.value = value; }}[/code]andpublic class Person{ private String name; private List<ChartField> chart; public String getName(){ return name; } public List<ChartField> getChart(){ return chart; }}[/code]So for jasper I pass as datasource a list of Person. The ideia is to each person I want to plot a bar chart with the list of ChartFields. Can anyone advice me how to do this? Thanks Link to comment Share on other sites More sharing options...
miwagada Posted October 22, 2018 Share Posted October 22, 2018 Hi, I think you should use JRBeanCollectionDataSource(<List>) method.you can refer below link: https://www.programcreek.com/java-api-examples/?api=net.sf.jasperreports.engine.data.JRBeanCollectionDataSource Hope it works Regards,Miwa Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now