Problem
Exporting images to JPG/PNG results in charts with a black background. This can be prevented by setting a white background on charts.
I don't think this was happening around the time of 5.0.8. But I think it's something that comes from highcharts export service (all exports are handled by their servers). Perhaps they were handling an empty (none) value differently before? I can't find release notes.
One way of dealing with this issue for new charts is to set a default background color value of white, then all newly created charts will have it by default and they will work as expected when exported. Unfortunately, existing ones will not automatically inherit this value as it is saved to each chart as empty.
Steps to reproduce
Create a chart without setting a background color. Then view chart and use export feature to generate chart to JPG or PNG. This will/should result in a chart on a black background.
Then, change the background to #FFFFFF, when exporting this will/should generate a chart on a white background.
Proposed resolution
- If no background has been provided, set background color to white for JPG exports, and to a transparent background for PNG exports. (not sure if that's possible?)
- Can anyone confirm if this was indeed a change in highcharts? if so, could they handle it differently? I've submitted an issue to inquire out about this but if a value of 'none' was invalid, then the change makes sense and the code here needs to be addressed by something like the point above.
Comments
Comment #2
andileco commented@cballenar, I think the difference is updating the libraries to version 11. Will look into this!
Comment #3
cballenar commentedThanks @andileco !
I tested rolling back to 5.0.4 but it still displayed the issue (assuming back then the version was different). Nonetheless let me know if you see different results. I appreciate any feedback on this!
Comment #4
cballenar commentedCorrection: this issue only happens with JPGs. PNGs do recognize the given value and result in charts with a transparent background. I thought I had PNG samples as well but I was mistaken.
Comment #5
crutch commentedThis may be a separate issue but seems related.
This also happens when using Print from the browser. If any color is used, including #ffffff, then the background is black. Only transparent works.
Comment #6
andileco commentedThis works with the current Highcharts.