Javascript examples for Chart.js:Bar Chart
change horizontal axis value for bar chart
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.bundle.js"></script> <script type="text/javascript"> window.onload=function(){/* w w w .j av a 2s. com*/ var ctx = document.getElementById("myChart").getContext("2d"); var data = { labels: ["Chocolate", "Vanilla", "Strawberry"], datasets: [{ label: "Offset", backgroundColor: "transparent", data: [50,100,70,60,100,100] }, { label: 'Actual Dataset', backgroundColor: 'Blue', borderWidth: 1, data: [50,20,30,40,30,70] }] }; var myBarChart = new Chart(ctx, { type: 'bar', data: data, options: { scales: { xAxes: [{ stacked: true }], yAxes: [{ stacked: true, }] }, } }); } </script> </head> <body> <canvas id="myChart" width="400" height="400"></canvas> </body> </html>