stack bar chart - Javascript highcharts

Javascript examples for highcharts:Bar Chart

Description

stack bar chart

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://code.jquery.com/jquery-1.9.1.js"></script> 
      <script type="text/javascript">
var x = [ [ ["W",20], ["M",9] ] ];
$(function () {//from www.  java 2 s . c o m
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Gschlecht'
            }
        },
        legend: {
            reversed: true
        },
        plotOptions: {
            series: {
                stacking: 'percent'
            }
        },
        series: [{
            name: x[0][0][0],
            data: [x[0][0][1]]
        }, {
            name: x[0][1][0],
            data: [x[0][1][1]]
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials