I'm trying to export example GRAL Pie plot to jpg using:
private byte[] getJpg() throws IOException {
BufferedImage bImage = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = bImage.createGraphics();
DrawingContext drawingContext = new DrawingContext(g2d, DrawingContext.Quality.QUALITY,
DrawingContext.Target.BITMAP);
PiePlot plot = getPlot();
plot.draw(drawingContext);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(bImage, "jpg", baos);
baos.flush();
byte[] bytes = baos.toByteArray();
baos.close();
return bytes;
}
But it renders as black rectangle with some legend information (legend is ok). Who knows the right way to render JPG from GRAL plot?