This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other Java Products and Servers and the fly likes Access elements of list for chart using java,ireport Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Access elements of list for chart using java,ireport" Watch "Access elements of list for chart using java,ireport" New topic
Author

Access elements of list for chart using java,ireport

prriya pratheep
Greenhorn

Joined: Jun 10, 2008
Posts: 22
I need to create a chart. I am getting parameter from java .

My java code

public static List<CostSales> randomData() {
List<CostSales> listOfCostSales = new ArrayList<CostSales>();
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


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.
 
wood burning stoves
 
subject: Access elements of list for chart using java,ireport