Horizontal bar chart in chart.js - Javascript Chart.js

Javascript examples for Chart.js:Bar Chart

Description

Horizontal bar chart in chart.js

Demo Code

ResultView the demo in separate window

<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.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from   w  w  w . ja va 2s  .c om
var MeSeContext = document.getElementById("MeSeStatusCanvas").getContext("2d");
var MeSeData = {
    labels: [
        "ME",
        "SE"
    ],
    datasets: [{
        label: "Test",
        data: [100, 75],
        backgroundColor: ["#669911", "#119966"],
        hoverBackgroundColor: ["#66A2EB", "#FCCE56"]
    }]
};
var MeSeChart = new Chart(MeSeContext, {
    type: 'horizontalBar',
    data: MeSeData,
    options: {
        scales: {
            xAxes: [{
                ticks: {
                  beginAtZero: true
                }
            }],
            yAxes: [{
               stacked: true
            }]
        }
    }
});
    }

      </script> 
   </head> 
   <body> 
      <canvas id="MeSeStatusCanvas"></canvas>  
   </body>
</html>

Related Tutorials