Javascript examples for Chart.js:Line Chart
How to set 2 y-axis title for line chart
<html> <head> <title>chart.js yAxes title/subtitle</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script> <script type="text/javascript"> window.onload=function(){/*from w w w. j ava2s . c o m*/ var data = { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [{ label: "My First dataset", backgroundColor: "rgba(255,99,132,0.2)", borderColor: "rgba(255,99,132,1)", borderWidth: 2, hoverBackgroundColor: "rgba(255,99,132,0.4)", hoverBorderColor: "rgba(255,99,132,1)", data: [65, 59, 20, 81, 56, 55, 40], },{ label: "My Second dataset", data: [35, 11, 10, 1, 6, 95, 0], }] }; var option = { title: { display: true, }, scales: { yAxes: [{ scaleLabel: { display: true, labelString: "subtitle", fontStyle: 'italic' } },{ display: true, gridLines: {display: false,color: 'transparent'}, ticks: {display: false}, scaleLabel: { display: true, labelString: "My Chart title", fontStyle: 'bold', fontSize: 14 } }] } }; var myLineChart = Chart.Line('myChart', { data: data, options: option }); } </script> </head> <body> <canvas id="myChart" width="400" height="300"></canvas> </body> </html>