Javascript examples for Chart.js:Axis
Using chartjs to show categorical values on axis
<html> <head> <title>chart.js 2.1</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.1.0/Chart.bundle.min.js"></script> <script type="text/javascript"> window.onload=function(){/*from w w w. j a v a2s. co m*/ var config = { type: 'line', data: { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [{ label: "My First dataset", data: [65, 0, 80, 81, 56, 85, 40], fill: false }] }, options: { scales: { yAxes: [{ ticks: { callback: function(value) { if (value === 20) return 'Low'; else if (value === 50) return 'Medium'; else if (value === 80) return 'High'; else return ''; } } }] } } }; var ctx = document.getElementById("myChart").getContext("2d"); new Chart(ctx, config); } </script> </head> <body> <canvas id="myChart"></canvas> </body> </html>