Jump to content
Changes to the Jaspersoft community edition download ×

chart displaying

2005 IR Help

Recommended Posts

By: ann - ann04

chart displaying

2004-10-18 11:05


I have a problem displaying a chart from my report. When I run FillReport, the file gets created but the chart image is not there, Please Help!

Here is what I have:


public static void main(String[] args) throws JRScriptletException{

try{JasperReport jasperReport = (JasperReport)JRLoader.loadObject("myFile.jasper");


conn = DriverManager.getConnection(url, "123", "123r");

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);



catch(Exception e){









private static java.awt.Image createEmployeeChartImage(){

//public void afterReportInit() throws JRScriptletException{



DefaultPieDataset dataset = new DefaultPieDataset();

dataset.setValue("Olga1", new Double(43.2));

dataset.setValue("Olga2", new Double(10.0));

dataset.setValue("C/C++", new Double(17.5));

dataset.setValue("PHP", new Double(32.5));

dataset.setValue("Python", new Double(1.0));


JFreeChart chart =


"Pie Chart 3D Demo 1",







PiePlot3D plot = (PiePlot3D) chart.getPlot();




plot.setNoDataMessage("No data to display");

return chart.createBufferedImage(500, 220);}



What is the correct stmt to draw the chart??

chart.createBufferedImage(500, 220) creates the image, then why I cannot see it?


Thank you





By: ann - ann04

RE: chart displaying

2004-10-18 12:13



Got it solved!





By: odc - sameena

RE: chart displaying

2004-10-20 02:07

hi ann04

i have the same problem can u tell me how u solved it.my code is just like urs.

when i export the report into a pdf a blank pdf page is generated on the browser


thks in advance






By: ann - ann04

RE: chart displaying

2004-10-21 12:44


It might be many reasons, but in my case i was looking for a problem in my jsp, when indeed the problem was with the xml file. I called my "chart" image as variable, instead of parameter. When I changed it, the picture showed up in the report.

Good luck!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...