Javascript examples for Chart.js:Chart Label
How to use same data / labels on two y axes
<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.6.0/Chart.min.js"></script> <script type="text/javascript"> window.onload=function(){//from ww w . ja v a 2s . c o m Chart.plugins.register({ beforeInit: function(chart) { chart.options.scales.yAxes[1].ticks.suggestedMin = Math.min.apply(this, chart.data.datasets[0].data); chart.options.scales.yAxes[1].ticks.suggestedMax = Math.max.apply(this, chart.data.datasets[0].data); } }); var chart = new Chart(ctx, { type: 'line', data: { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'], datasets: [{ label: 'LINE', data: [3, 1, 4, 2, 5], backgroundColor: 'rgba(0, 119, 290, 0.2)', borderColor: 'rgba(0, 119, 290, 0.6)', fill: false }] }, options: { scales: { yAxes: [{ id: 'y-axis-0', position: 'left', ticks: { stepSize: 1 } }, { id: 'y-axis-1', position: 'right', ticks: { stepSize: 1 } }] } } }); } </script> </head> <body> <canvas id="ctx"></canvas> </body> </html>