dpriya.pratheep Posted February 21, 2013 Share Posted February 21, 2013 I need to create a chart. I am getting parameter from java . My java code public static List randomData() { List listOfCostSales = new ArrayList(); listOfCostSales.add(new CostSales(10.2,1)); listOfCostSales.add(new CostSales(20.2,2)); listOfCostSales.add(new CostSales(30.2,3)); listOfCostSales.add(new CostSales(40.2,4)); return listOfCostSales;} parameters.put("listOfCostSales", randomData()); jasperPrint = JasperFillManager.fillReport(jasperReport,parameters,dataSource); Then In Ireport I created a chart . In main dataset I created a parameter listOfCostSales as list and cost and month. And created a subdataset Chartdata with listOfCostSales, sale, month. In chart data Connection/DataSource Expression, I used Use connection expression from the drop down and set value new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{listOfCostSales}) Parameters Map Expression$P{REPORT_PARAMETERS_MAP} Parameters cost $P{cost} and month $P{month} I don't know what is wrong with my code. I can't access elements of list. I am getting null key .. For testing Printed month and cost by drag droping. I am getting null Please help me .I am struggling with this for last two week. Almost googled most of the sites and failed to find out the answer. 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