I'm using the Batik conversion code as Vaadin suggests however I need to make the background of the PNG image transparent because it can be displayed in containers of different colors and I don't want the white border to show. I've tried everything I can think of and I can't seem to find a way to make the background of the PNG transparent. I've even tried to force the background color to help Batik but it doesn't work:
chart.getConfiguration().getChart().setBackgroundColor(new SolidColor("#FFFFFF"));
I've then tried combinations (either, or both) of:
pngTranscoder.addTranscodingHint(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE, Boolean.TRUE);
pngTranscoder.addTranscodingHint(PNGTranscoder.KEY_BACKGROUND_COLOR, java.awt.Color.WHITE);
And nothing seems to work. Any suggestions on how to do this would be greatly appreciated.
There are two colors set:
new SolidColor(255, 255, 255, 0.0)
the last is the Alpha value, the opacity, where 1.0 would be fully opaque, 0.0 totally transparent.
And the actual color:
new Color(0x00FFFFFF, true)
with the constructor for RGBA.