views:

73

answers:

0

Hi, I am using jasper reports to generate graph. I am refresheing the graph by using session.addHeader("Refresh",10);

But the problem is while refreshing the graph it is flickering. Code is-

PrintWriter out = response.getWriter(); response.setContentType("text/html"); JRDataSource dataSource = createReportDataSource(perfArrayListSample.toArray());

ServletContext context = this.getServletConfig().getServletContext(); File reportFile = new File(context.getRealPath("/cpuUsageGraph.jasper")); if (!reportFile.exists()) throw new JRRuntimeException("File cpuUsageGraph.jasper not found. The report design must be compiled first.");

JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath()); JasperPrint print = JasperFillManager.fillReport(jasperReport, new HashMap(), dataSource);

JRHtmlExporter exporter = new JRHtmlExporter();

request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, print); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?ver="+new Date().getTime() +"&image="); exporter.exportReport(); perfArrayListSample.clear();

So how to refresh the graph wihout flickering?