Unable to convert jfreechart to jpeg image
Posted: Wed Apr 29, 2009 4:40 pm
hi,
I was using jfreechart-1.0.1.jar in my application for plotting a chart. After that, the chart is converted to jpeg image for display. The code snippet used for this purpose was:
BufferedImage bufImage = chart.createBufferedImage(800, 425, null);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( response.getOutputStream() );
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam( bufImage );
param.setQuality( 0.75f, true );
encoder.encode( bufImage, param );
ImageIO.write ( bufImage,"jpeg",out );
Now I have updated the jfreechart to 1.0.13 version.But the above mentioned code snippet is not working i.e, image is not displaying.. Tried by changing the image format to .png and now the image is displaying.Can anyone help on this please?
I was using jfreechart-1.0.1.jar in my application for plotting a chart. After that, the chart is converted to jpeg image for display. The code snippet used for this purpose was:
BufferedImage bufImage = chart.createBufferedImage(800, 425, null);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder( response.getOutputStream() );
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam( bufImage );
param.setQuality( 0.75f, true );
encoder.encode( bufImage, param );
ImageIO.write ( bufImage,"jpeg",out );
Now I have updated the jfreechart to 1.0.13 version.But the above mentioned code snippet is not working i.e, image is not displaying.. Tried by changing the image format to .png and now the image is displaying.Can anyone help on this please?