stacked bar chart scale centering - Javascript highcharts

Javascript examples for highcharts:Stack Chart

Description

stacked bar chart scale centering

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">
$(function () {/*from   w  w w.j  ava  2 s  .co m*/
    var chart;
    $(document).ready(function() {
        $('#container').highcharts({
            chart: {
                type: 'bar'
            },
            xAxis: [{
                reversed: false
            }, { // mirror axis on right side
                opposite: true,
                reversed: false,
                //categories: categories,
                linkedTo: 0
            }],
            plotOptions: {
                series: {
                    stacking: 'normal',
                    borderWidth: 0
                }
            },
            series: [{
                name: 'Strongly Disagree',
                data: [-10, -5, -6]
            }, {
                name: 'Disagree',
                data: [-2, -5, -3]
            }, {
                name: 'Neutral',
                data: [-2, -5, -3],
                color: 'gray',
                id: 'neutral'
            },{
                name: 'Strongly Agree',
                data: [5, 1,6]
            },{
                name: 'Agree',
                data: [6, 8, 2]
            },{
                name: 'Neutral',
                data: [2, 5, 3],
                color: 'gray',
                linkedTo: 'neutral'
            }]
        });
    });
});

      </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: 400px; max-width: 800px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials