Javascript examples for Chart.js:Chart Configuration
Chart.js to add padding to scales
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* ww w. ja va2s . c om*/ var ctx = document.getElementById("myChart"); var data = { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [ { label: "My First dataset", fill: false, lineTension: 0.1, backgroundColor: "rgba(75,192,192,0.4)", borderColor: "rgba(75,192,192,1)", borderCapStyle: 'butt', borderDash: [], borderDashOffset: 0.0, borderJoinStyle: 'miter', pointBorderColor: "rgba(75,192,192,1)", pointBackgroundColor: "#fff", pointBorderWidth: 1, pointHoverRadius: 5, pointHoverBackgroundColor: "rgba(75,192,192,1)", pointHoverBorderColor: "rgba(220,220,220,1)", pointHoverBorderWidth: 2, pointRadius: 1, pointHitRadius: 10, data: [0, 10, 24, 64, 100, 256, 512], spanGaps: false, } ] }; var myChart = new Chart(ctx, { type: 'line', data: data, options: { scales: { yAxes: [{ ticks: { padding: 80, min: -100 } }] } } }); } </script> </head> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min.js"></script> <canvas id="myChart" width="400" height="400"></canvas> </body> </html>