Javascript examples for Chart.js:Line Chart
Show label in tooltip for chartjs line chart
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://rawgit.com/nnnick/Chart.js/v1.0.2/Chart.min.js"></script> <script type="text/javascript"> window.onload=function(){//from w w w. ja v a2 s .c om Chart.types.Line.extend({ name: "LineAlt", initialize: function (data) { Chart.types.Line.prototype.initialize.apply(this, arguments); var xLabels = this.scale.xLabels xLabels.forEach(function (label, i) { if (i % 2 == 1) xLabels[i] = ''; }) } }); var lineChartData = { labels: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], datasets: [ { fillColor: "#79D1CF", strokeColor: "#79D1CF", data: [59, 80, 81, 56, 55, 40, 34, 43, 43, 12, 65, 65] } ] }; var ctx = document.getElementById("myChart").getContext("2d"); var myLine = new Chart(ctx).LineAlt(lineChartData); } </script> </head> <body> <canvas id="myChart" height="300" width="800"></canvas> </body> </html>