Hi,
i want to create an image out of a chart without saving it directly. My intention is to add it as an image to a pdf-file. I dont want to write it directly to a pdf because i want to handle the "positioning" somewhere else in the code.
Regards
Tobias
Creating image without saving it
You want to hold the image in memory as a buffered image :
then when you want the image
Hope this helps
Ian
Code: Select all
bufferedImage = chart.createBufferedImage(width, height);
Code: Select all
ChartUtilities.writeBufferedImageAsPNG(out, bufferedImage);
Ian
hi IanGuest wrote:You want to hold the image in memory as a buffered image :
then when you want the imageCode: Select all
bufferedImage = chart.createBufferedImage(width, height);
Hope this helpsCode: Select all
ChartUtilities.writeBufferedImageAsPNG(out, bufferedImage);
Ian
Some how i am also in similar case, but i dont want to write
but i wanted to show it in html ,<img> tag from the buffer
can i get help from you?
Regards
Vaaji
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Call response.getOutputStream() on the HttpServletResponse. Then do something like this:
Code: Select all
response.setContentType("image/png");
ChartUtilities.writeChartAsPNG(out, chart, 400, 300);
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

