Javascript examples for Chart.js:Chart Color
Chart area background color settings chartjs
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.js"></script> <script type="text/javascript"> window.onload=function(){/* ww w. j a v a2 s .c om*/ var ctx = document.getElementById("barChart"); ctx.style.backgroundColor = 'rgba(255,0,0,255)'; var barChart = new Chart(ctx,{ type: 'bar', data: { labels:["Label1","Label2","Label3","Label4"], borderColor : "#fffff", datasets: [ { data: ["2","3","1","4"], borderColor : "#fff", borderWidth : "3", hoverBorderColor : "#000", backgroundColor: [ "#f38b4a", "#56d798", "#ff8397", "#6970d5" ], hoverBackgroundColor: [ "#f38b4a", "#56d798", "#ff8397", "#6970d5" ] }] }, options: { scales: { yAxes: [{ ticks:{ min : 0, stepSize : 1, fontColor : "#000", fontSize : 14 }, gridLines:{ color: "#000", lineWidth:2, zeroLineColor :"#000", zeroLineWidth : 2 }, stacked: true }], xAxes: [{ ticks:{ fontColor : "#000", fontSize : 14 }, gridLines:{ color: "#fff", lineWidth:2 } }] }, responsive:false } }); } </script> </head> <body> <canvas id="barChart" width="600" height="300"></canvas> </body> </html>