Javascript examples for Chart.js:Chart Configuration
ChartJS beginAtZero, min, max setting
<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.4.0/Chart.bundle.min.js"></script> <script type="text/javascript"> window.onload=function(){// w ww.ja v a2 s.co m var options = { responsive: true, scales: { yAxes: [{ display: true, ticks: { beginAtZero: true, max: 100, min: 0 } }] }, title: { display: true, text: name }, tooltips: { mode: 'index', intersect: false, }, hover: { mode: 'nearest', intersect: true }, }; var data = { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [32, 59, 36, 25, 68, 71], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] } var ctx = document.getElementById("myChart"); var chartInstance = new Chart(ctx, { type: 'line', data: data, options:options }); } </script> </head> <body> <h2> Hello World! </h2> <canvas id="myChart"></canvas> </body> </html>