Hi all,
I have issue here.
I have created a JFreechart object. Now i want to save the chart as .png file and then want to have the corresponding image map from it. Like this:
ChartUtilities.saveChartAsPNG(new File("temp/reports/chart1"+number+".png"), chart, 800,600);
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeImageMap(new PrintWriter(System.out), "temp/reports/chart1"+number+".png", info, false);
Once i run this program i get the .png in the dirtectory specified but see a empty image map like this
<map id="temp/reports/chart119.png" name="temp/reports/chart119.png">
</map>
What am i doing wrong here??
Although when i use servletUtilities
filename = ServletUtilities.saveChartAsPNG(chart, 500, 300, info, session);
ChartUtilities.writeImageMap(pw, filename, info);
I get the desired output.
Can please someone help me with this?
Thank you
Empty image Map when using ChartUtilities.saveChartAsPNG
-
- Posts: 9
- Joined: Wed Mar 26, 2008 6:20 am
What kind of chart are you using?
There was just a report about a bug with image maps and block graphs: http://www.jfree.org/phpBB2/viewtopic.php?t=24269
hth,
- martin
There was just a report about a bug with image maps and block graphs: http://www.jfree.org/phpBB2/viewtopic.php?t=24269
hth,
- martin
-
- Posts: 9
- Joined: Wed Mar 26, 2008 6:20 am
I am using simple stacked Area chart.
I got it working by
ChartRenderingInfo info = new ChartRenderingInfo(
new StandardEntityCollection());
ChartRenderingInfo info1 = new ChartRenderingInfo(
new StandardEntityCollection());
File file1 = new File("ImageMapDemo7.png");
ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
// write an HTML page incorporating the image with an image map
File file2 = new File("ImageMapDemo7.html");
OutputStream out = new BufferedOutputStream(
new FileOutputStream(file2));
System.err.println(ImageMapUtilities.getImageMap("chart", info));
Any other way in whcih i donot have to call so many io methods.
I got it working by
ChartRenderingInfo info = new ChartRenderingInfo(
new StandardEntityCollection());
ChartRenderingInfo info1 = new ChartRenderingInfo(
new StandardEntityCollection());
File file1 = new File("ImageMapDemo7.png");
ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
// write an HTML page incorporating the image with an image map
File file2 = new File("ImageMapDemo7.html");
OutputStream out = new BufferedOutputStream(
new FileOutputStream(file2));
System.err.println(ImageMapUtilities.getImageMap("chart", info));
Any other way in whcih i donot have to call so many io methods.