grouped bar charts with multiple axes - Javascript highcharts

Javascript examples for highcharts:Bar Chart

Description

grouped bar charts with multiple axes

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 ww  w  .ja v  a 2 s  .  c  o  m*/
  $('#container').highcharts({
    chart: {
      type: 'bar'
    },
    title: {
      text: 'Fruits eaten'
    },
    series: [{
           name: 'John',
           id: 's1',
          data: [5, 3],
      },{
          linkedTo: 's1',
           name: 'John',
           data: [
                [2, 0.4]
           ],
           yAxis: 1,
           color: Highcharts.getOptions().colors[0]
      },{
           data: [3, 4],
           id: 's2',
           name: 'Joe'
      },{
           linkedTo: 's2',
         name: 'Joe',
         data: [
                [2, 0.6]
         ],
         yAxis: 1,
           color: Highcharts.getOptions().colors[1]
      },{
         data: [2, 5],
         id: 's3',
         name: 'Jane'
      },{
         linkedTo: 's3',
         name: 'Jane',
         data: [
                [2, 0.7]
         ],
         yAxis: 1,
         color: Highcharts.getOptions().colors[2]
      },{
         data: [3, 0],
         id: 's4',
         name: 'Janet'
      },{
        linkedTo: 's4',
        name: 'Janet',
        data: [
             [2, 0.8]
        ],
        yAxis: 1,
        color: Highcharts.getOptions().colors[3]
      }
    ],
    plotOptions: {
      column: {
        dataLabels: {
          enabled: true
        }
      }
    },
    xAxis: {
      type: 'category',
      categories: ['Count A', 'Count B', 'Percent']
    },
    yAxis: [{
       opposite: true
    }, {
      gridLineWidth: 0,
      opposite: false,
      title: {
        text: 'Percent'
      }
    }]
  });
});

      </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