Change color of series in bar chart? - Javascript highcharts

Javascript examples for highcharts:Bar Chart

Description

Change color of series in bar chart?

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  av a  2 s  . c  om*/
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        series: [{
            name: 'Year 1800',
            data: [107, 31, 635, 203, 2]
        }]
    },function(chart){
        $('#btn').click(function () {
            chart.series[0].data[1].graphic.attr({
                "fill":"red"
            });
        });
    });
});

      </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; height: 400px; margin: 0 auto"></div> 
      <button id="btn">change color</button>  
   </body>
</html>

Related Tutorials