Javascript examples for Chart.js:Chart Data
ChartJS to set dataset background
<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.2.1/Chart.min.js"></script> <script type="text/javascript"> window.onload=function(){//from w w w. j av a 2s . c om var ctx = document.getElementById("canvas"); var myChart = new Chart(ctx, { type: 'line', data: { labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug"], datasets: [{ label: '# of Value', data: [12, 19, 3, 5, 2, 3, 10, 29], backgroundColor: 'rgba(33, 145, 81, 0.2)', borderColor: 'rgba(33, 145, 81, 1)', borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); } </script> </head> <body> <canvas id="canvas" height="200"></canvas> </body> </html>