Search code examples
htmlcsscanvasjs

CanvasJS Transparent Background


I'm trying to add transparency to my CanvasJS background. CanvasJS uses backgroundColor in order to choose the color of the background of the canvas.

I tried writing "None" instead of a color code but it's giving me a black background.

Also it would be nice to have the ability to choose different opacities for the background.


Solution

  • To set transparent background you can set backgroundColor: "transparent". And if you like to give transparency to any color you can use rgba color coding, for example: backgroundColor: "rgba(225,150,150,0.5)".