.write(ChartUtilities.encodeAsPNG(chart.createBufferedImage(width, height)));
/** * Writes the given JFreeChart to the kmz file specified for the kmz writer attribute of this class. * @param filename the filename to use in the kmz * @param chart * @throws IOException */ private void writeChartToKmz(final String filename, final JFreeChart chart) throws IOException { byte [] img; img = ChartUtilities.encodeAsPNG(chart.createBufferedImage(CHARTWIDTH, CHARTHEIGHT)); this.writer.addNonKMLFile(img, filename); }
/** * Writes the given JFreeChart to the kmz file specified for the kmz writer * attribute of this class. * * @param filename * the filename to use in the kmz * @param chart * @throws IOException */ private void writeChartToKmz(final String filename, final JFreeChart chart) throws IOException { byte[] img; img = ChartUtilities.encodeAsPNG(chart.createBufferedImage(CHARTWIDTH, CHARTHEIGHT)); this.writer.addNonKMLFile(img, filename); }
defaultHeight), null, null); out.write(encodeAsPNG(image));
/** * Helper method that returns the JFreeChart as a PNG byte array. * * @param chartName a {@link java.lang.String} object. * @return a byte array * @throws java.io.IOException if any. * @throws java.sql.SQLException if any. */ public static byte[] getBarChartAsPNGByteArray(String chartName) throws IOException, SQLException { BarChart chartConfig = getBarChartConfigByName(chartName); JFreeChart chart = getBarChart(chartName); ImageSize imageSize = chartConfig.getImageSize(); int hzPixels; int vtPixels; if (imageSize == null) { hzPixels = 400; vtPixels = 400; } else { hzPixels = imageSize.getHzSize().getPixels(); vtPixels = imageSize.getVtSize().getPixels(); } return ChartUtilities.encodeAsPNG(chart.createBufferedImage(hzPixels, vtPixels)); }
/** * Helper method that returns the JFreeChart as a PNG byte array. * * @param chartName a {@link java.lang.String} object. * @return a byte array * @throws java.io.IOException if any. * @throws java.sql.SQLException if any. */ public static byte[] getBarChartAsPNGByteArray(String chartName) throws IOException, SQLException { BarChart chartConfig = getBarChartConfigByName(chartName); JFreeChart chart = getBarChart(chartName); ImageSize imageSize = chartConfig.getImageSize(); int hzPixels; int vtPixels; if (imageSize == null) { hzPixels = 400; vtPixels = 400; } else { hzPixels = imageSize.getHzSize().getPixels(); vtPixels = imageSize.getVtSize().getPixels(); } return ChartUtilities.encodeAsPNG(chart.createBufferedImage(hzPixels, vtPixels)); }