bar chart with multiple series - Javascript highcharts

Javascript examples for highcharts:Bar Chart

Description

bar chart with multiple series

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  a v a 2 s  . co m
    $('#container').highcharts(
    {
        chart: {
            type: 'column',
            inverted: true
        },
      plotOptions: {
            series: {
                dataLabels: {
                    enabled: true,
                    formatter:function() {
                        if(this.y > 0){
                           return this.y;
                            return this.point.y;
                      }
                    }
                }
            }
        },
        yAxis: {
            allowDecimals: false,
            min: -1,
            labels: {
                formatter: function () {
                    return this.value + '%';
                }
            },
            title: {
                text: '   ',
                margin:40
         }
        },
        xAxis: {
            categories: ['Test1', 'Test2', 'Test3', 'Test4', 'Test5','Test6','Test7']
        },
        legend: {
            enabled: true,
            floating: true,
            verticalAlign: 'bottom',
            align:'middle',
            backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
            borderWidth: 1,
         y:10,
            x:350
        },
        series: [{
            name: 'GroupA',
            color: 'rgba(223, 83, 83, .5)',
            data: [{y:null},{y:null}, {y:null}, {y:null}, {y:2.9}, {y:0.5}, {y:1.5}]
        },{
            name: 'GroupB',
            color: 'rgba(119, 152, 191, .5)',
            data: [{y:6.5}, {y:3.9}, {y:8.5}, {y:6.6},{y:null},{y:null},{y:null}]
        }],
            title: {
            text: "Test"
        }
    }
    );
});

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