The image cannot be displayed -Netscape 7.01
The image cannot be displayed -Netscape 7.01
Hello,
I am getting a problem with the JFreeChart in Netscape 7.01. (also tested with NS 6.0)
I get the message "The image ............ cannot be diaplayed, because it contains errors".
The chart works fine in IE. Before I upgraded to the newer version, the one containing the image map and tooltips, this was working fine in Netscape. I thought initially that it might be a problem with the tooltips not being able to be displayed so I set the boolean tooltips parameter on ChartFactory.createVerticalBarChart to false hoping this will solve the problem, but it doesn't.
Does anyone know what else I should look out for or anyone know what the problem is?
Thankyou.
Shawn
I am getting a problem with the JFreeChart in Netscape 7.01. (also tested with NS 6.0)
I get the message "The image ............ cannot be diaplayed, because it contains errors".
The chart works fine in IE. Before I upgraded to the newer version, the one containing the image map and tooltips, this was working fine in Netscape. I thought initially that it might be a problem with the tooltips not being able to be displayed so I set the boolean tooltips parameter on ChartFactory.createVerticalBarChart to false hoping this will solve the problem, but it doesn't.
Does anyone know what else I should look out for or anyone know what the problem is?
Thankyou.
Shawn
Re: The image cannot be displayed -Netscape 7.01
should have mentioned that the version I am using is 0.9.4
Shawn
Shawn
Re: The image cannot be displayed -Netscape 7.01
I'm not sure what the problem is. Does it fail with JPEG, PNG or both?
Regards,
Dave Gilbert
Regards,
Dave Gilbert
Re: The image cannot be displayed -Netscape 7.01
I work with Shawn and have been experiencing the same problems, the graph displays fine in IE6 but not in Netscape6 or 7 or Mozilla.
It happens with both JPEG and PNG.
I found this but the solution given was already set in my browser. http://mozilla.gunnars.net/mozfaq_use.html#imageerror
So we are both still stuck.
Thanks for the reply and let us know if you think of anything.
Dan
It happens with both JPEG and PNG.
I found this but the solution given was already set in my browser. http://mozilla.gunnars.net/mozfaq_use.html#imageerror
So we are both still stuck.
Thanks for the reply and let us know if you think of anything.
Dan
Re: The image cannot be displayed -Netscape 7.01
Have you tried using the example WAR file at http://homepage.ntlworld.com/richard_c_ ... freechart/?
I have tested the WAR file with Netscape 7, Opera and IE and it works fine with all of them. I have also heard reports that it works fine with Mozilla as well.
Regards,
Richard...
I have tested the WAR file with Netscape 7, Opera and IE and it works fine with all of them. I have also heard reports that it works fine with Mozilla as well.
Regards,
Richard...
Re: The image cannot be displayed -Netscape 7.01
Having read the Mozilla bug report I suspect the problem is that you application is designed in such a way that requesting the image again without re-requesting the page is causing a problem. You might want to look at the classes in com.jrefinery.chart.servlet which are designed to avoid this by persisting charts to the temporary directory and using the DisplayChart servlet to stream charts back to the browser. It is not possible to predict when browsers will re-request images without requesting the page. It happens most frequently when printing pages (you may want to try that with your application using IE - I suspect your charts will not print correctly).
I hope this helps,
Regards,
Richard...
I hope this helps,
Regards,
Richard...
Re: The image cannot be displayed -Netscape 7.01
Thanks for the advice.
Yes, I can view the WAR file provided in all my browsers and I am now trying to implement the code to persist charts to the temporary directory.
I can, however, print the charts as they are in IE without any problems. I don't know if this is significant.
I'll let you know how I get on,
Thanks a lot
Dan
Yes, I can view the WAR file provided in all my browsers and I am now trying to implement the code to persist charts to the temporary directory.
I can, however, print the charts as they are in IE without any problems. I don't know if this is significant.
I'll let you know how I get on,
Thanks a lot
Dan
Re: The image cannot be displayed -Netscape 7.01
Thanks a lot for your help the code worked perfectly.
Dan and Shawn
Dan and Shawn
Re: The image cannot be displayed -Netscape 7.01
Sorry my mistake only the png chart images are being displayed without any html and therefore without the image maps. Below is the code I am using. If you have any suggestions I would really appreciate it.
Thanks
Dan
HttpSession session = request.getSession();
JFreeChart chart = createChart( quarter, groupCode, viewName, practicecode, startDate, endDate, request, type, initGradColor, finalGradColor );
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
int width = 900;
int height = 500;
String fileName = General.getUniqueFileName("Output",10,".png");
String realFileName = getServletContext().getRealPath(fileName);
FileOutputStream fileOut = new FileOutputStream(realFileName);
ChartUtilities.writeChartAsPNG(fileOut, chart, width, height);
fileOut.close();
realFileName = ServletUtilities.searchReplace(realFileName, "..", "");
File file = new File(realFileName);
if (!file.exists()) {
throw new ServletException("File '" + file.getAbsolutePath()
+ "' does not exist");
}
ServletUtilities.sendTempFile(file, response);
ChartUtilities.saveChartAsPNG(file, chart, width, height, info);
PrintWriter out = response.getWriter();
CommonHTML ch = new CommonHTML(out);
out.println("<html>");
out.println("<head>");
out.println(" <title>Groups Chart</title>");
ch.writeCSS();
out.println("</head>");
out.println("<body>");
ChartUtilities.writeImageMap(out, "map", info);
out.println(" <IMG src=\"../" + fileName + "\" usemap=\"#map\" border=0>");
out.println("</body>");
out.println("</html>");
out.close();
Thanks
Dan
HttpSession session = request.getSession();
JFreeChart chart = createChart( quarter, groupCode, viewName, practicecode, startDate, endDate, request, type, initGradColor, finalGradColor );
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
int width = 900;
int height = 500;
String fileName = General.getUniqueFileName("Output",10,".png");
String realFileName = getServletContext().getRealPath(fileName);
FileOutputStream fileOut = new FileOutputStream(realFileName);
ChartUtilities.writeChartAsPNG(fileOut, chart, width, height);
fileOut.close();
realFileName = ServletUtilities.searchReplace(realFileName, "..", "");
File file = new File(realFileName);
if (!file.exists()) {
throw new ServletException("File '" + file.getAbsolutePath()
+ "' does not exist");
}
ServletUtilities.sendTempFile(file, response);
ChartUtilities.saveChartAsPNG(file, chart, width, height, info);
PrintWriter out = response.getWriter();
CommonHTML ch = new CommonHTML(out);
out.println("<html>");
out.println("<head>");
out.println(" <title>Groups Chart</title>");
ch.writeCSS();
out.println("</head>");
out.println("<body>");
ChartUtilities.writeImageMap(out, "map", info);
out.println(" <IMG src=\"../" + fileName + "\" usemap=\"#map\" border=0>");
out.println("</body>");
out.println("</html>");
out.close();