How can i add an image as background in Chartjs?

14.5k views Asked by At

I am using chart.js lib on a programmable device i need to add an image as background to my chart, if that is not possible how can i change background color to black?. I cannot use Jquery as it is not supported by the Platform.

Thank you

2

There are 2 answers

0
potatopeelings On BEST ANSWER

You can style the canvas element. Something like this will work

canvas {
    background-color: black;
}

Fiddle - https://jsfiddle.net/w1yhp03h/

2
Sabba On

Thank you!

I didn't think to CSS, i added an image too in a similar way

canvas {
   background-image: url(backgroundimage.jpg);
}