HI All:
I am using the below to diplay the line graph. when i run the below code, i am getting the window but it is blank and not displaying the graph. Please help me
I did this some time ago as well, but I also have the code, so here's the clue..
As Thorbjørn Ravn Andersen said you have to have a servlet generating images instead of web pages. That means that your servlet's processRequest method looks something like this:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("image/png");
ServletOutputStream os = response.getOutputStream();
ImageIO.write(getChart(request), "png", os);
os.close();
}
private RenderedImage getChart(HttpServletRequest request) {
String chart = request.getParameter("chart");
// also you can process other parameters like width or height here
if (chart.equals("myDesiredChart1")) {
JFreeChart chart = [create your chart here];
return chart.createBufferedImage(width, height)
}
Then you can use this servlet as a source of image in other pages for example like this..
And you're done :)