Bar chart with negative and neutral stack - Javascript highcharts

Javascript examples for highcharts:Bar Chart

Description

Bar chart with negative and neutral stack

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/highcharts-more.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
  chart: {//from  www . j a v  a2 s . c o  m
    type: 'columnrange',
    inverted: true
  },
  xAxis: {
    categories: ['Q1', 'Q2']
  },
  legend: {
    enabled: false
  },
  series: [{
    name: 'Answers',
    data: [
    // Question 1
       {
        x: 0,
        low: -10,
        high: -5,
        color: 'red'
      }, {
        x: 0,
        low: -5,
        high: 5,
        color: 'blue'
      }, {
        x: 0,
        low: 5,
        high: 10,
        color: 'green'
      },
         // Question 2
      {
        x: 1,
        low: -15,
        high: -2,
        color: 'red'
      }, {
        x: 1,
        low: -2,
        high: 8,
        color: 'blue'
      }, {
        x: 1,
        low: 8,
        high: 20,
        color: 'green'
      }
    ]
  }]
});

      </script>  
   </body>
</html>

Related Tutorials