Change color of column for bar chart - Javascript highcharts

Javascript examples for highcharts:Column Chart

Description

Change color of column for 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"> 
      <style id="compiled-css" type="text/css">

#container {//from   w ww .  j a v a  2  s . c o m
   min-width: 310px;
   max-width: 800px;
   height: 400px;
   margin: 0 auto
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
    chart: {
        events: {
            load: function() {
                Highcharts.each(this.series[0].points, function(p) {
                    if (p.y > 8) {
                        p.update({
                            color: 'red'
                        });
                    }
                });
            }
        }
    },
    series: [{
        type: 'bar',
        data: [1, 2, 3, 4, 5, 6, 7, 8, 9]
    }]
});

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

Related Tutorials