Javascript examples for Chart.js:Chart Color
change chart.js color fill or y axes
<html> <head> <title>Chart</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script> <script type="text/javascript"> window.onload=function(){/*from www . j a va2s.c o m*/ var canvas = document.getElementById('updating-chart'), ctx = canvas.getContext('2d'), startingData = { labels: ["A", "B", "C", "D"], datasets: [ { label: "Product A", backgroundColor:"rgba(206, 70, 90, 1)", fillColor: "rgba(206, 70, 90, 1)", strokeColor: "rgba(220,220,220,0.8)", pointColor: "rgba(220,220,220,1)", pointStrokeColor: "#fff", data: [65, 59, 80, 81] } ] }; var myLiveChart = new Chart(ctx,{ type: 'bar', data: startingData, responsive: true, maintainAspectRatio: true, options: { scales: { yAxes: [{ ticks: { beginAtZero:true, min: 0, max: 10 } }] } } }); setInterval(function(){ // Get a random index point var indexToUpdate = Math.round(Math.random() * startingData.labels.length); // Update one of the points in the second dataset myLiveChart.data.datasets[0].data[indexToUpdate] = Math.random() * 100; myLiveChart.update(); }, 500); } </script> </head> <body> <canvas id="updating-chart" width="640" height="480"></canvas> </body> </html>