Hide/Show multiple series in bar chart - Javascript highcharts

Javascript examples for highcharts:Bar Chart

Description

Hide/Show multiple series in bar 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 w w w.jav a  2 s . c  o m
    $('#container').highcharts({
        chart: {
            marginBottom: 120,
            marginLeft: 80,
            width: 500
        },
        xAxis: {
            type: 'category',
            tickWidth: 0,
            lineColor: "#C0D0E0",
            lineWidth: 1,
            categories: ['dog', 'bird']
        },
        legend: {
            width: 400,
            floating: true,
            align: 'left',
            x: 70, // = marginLeft - default spacingLeft
            itemWidth: 70,
            borderWidth: 0,
            enabled: true
        },
        plotOptions: {
            colorByPoint: true,
            column: {
                pointPadding: 0,
                borderWidth: 0,
                grouping: false
            }
        },
        series: [{
            type: "column",
            name: "dog",
            data: [{
                age: 52,
                x: 0,
                y: 52
            }]
        }, {
            type: "column",
            name: "bird",
            data: [{
                age: 12,
                x: 1,
                y: 12
            }]
        }]
    });
});

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

Related Tutorials