Hi,
I am facing issues in generating a Line Chart using JasperReports.
I have created a .jasper file using iReport and using the same in JasperReports to generate the graph. I could do this successfully to create the tabular data using iReport and JasperReports.
However, nothing is printed in the output when i try it for a Chart. Below, is the code i am using:
protected void genLine(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
Map parameters = new HashMap();
jasperPrint = JasperFillManager.fillReport("LineData.jasper", parameters, getConnection());
JRHtmlExporter exporter = new JRHtmlExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,response.getWriter());
Map imagesMap = new HashMap();
request.getSession().setAttribute("IMAGES_MAP", imagesMap);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, false);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,"image?image=");
exporter.setParameter(JRHtmlExporterParameter.OUTPUT_STRING_BUFFER,sbf);
exporter.exportReport();
}
catch(JRException e) {
System.out.println("i am an e exception");
e.printStackTrace();
}
catch (Exception e1)
{
System.out.println("i am an e1 exception");
e1.printStackTrace();
}
finally {
out.flush();
out.close();
}
}
Please let me know, if i am missing anything here.
Thanks in advance, Karthik