Javascript examples for Chart.js:Line Chart
Set value in y-axis in line chart chart.js
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.3.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.bundle.min.js"></script> <script type="text/javascript"> window.onload=function(){//from ww w . j av a 2 s . c o m var ticks = [1000000, 500000, 100000, 50000, 1000, 500, 100, 50, 10, 5, 1, 0]; var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'line', data: { labels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"], datasets: [{ data: [6000, 5000, 8000, 2000, 10000, 3500, 6000, 2000, 4000, 6000] }] }, options: { scales: { yAxes: [{ ticks: { autoSkip: false, min: ticks[ticks.length - 1], max: ticks[0] }, afterBuildTicks: function(scale) { scale.ticks = ticks; return; }, beforeUpdate: function(oScale) { return; } }] } } }); } </script> </head> <body> <canvas id="myChart" width="400" height="400"></canvas> </body> </html>