stacked categories in column chart - Javascript highcharts

Javascript examples for highcharts:Column Chart

Description

stacked categories in column chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function () {//from   ww  w  .  j a v  a  2  s. c  o  m
    $('#container').highcharts({
        chart: {
            type: "column"
        },
        xAxis: {
            categories: ['Jan 2 2013', 'Jan 3 2013', 'Jan 4 2013', 'Jan 5 2013', 'Jan 6 2013', 'Jan 7 2013', 'Jan 8 2013']
        },
        yAxis: {
            stackLabels: {
                enabled: true,
                formatter: function() {
                    if (this.total) {
                        return this.stack;
                    } else {
                         return null;
                    }
                }
            }
        },
        plotOptions: {
            column: {
                stacking: 'normal',
                pointRange:1
            }
      },
        series: [
            {
                name: "Cinema",
                stack: "out",
                data: [[0,35]]
            },
            {
                name: "Sweets",
                stack: "out",
                data: [[1,12], [6,23]]
            },
            {
                name: "Games",
                stack: "out",
                data: [[1,10],[4,11]]
            },
            {
                name: "Job",
                stack: "in",
                data: [[6,52]]
            }
        ]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px; width: 500px"></div>  
   </body>
</html>

Related Tutorials