style last column in column chart - Javascript highcharts

Javascript examples for highcharts:Column Chart

Description

style last column in column 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-3.1.1.js"></script> 
      <script type="text/javascript">
$(function () {/*w w  w.  j  av a  2 s .co  m*/
var histSuccess=[100, 99, 100, 98, 98, 99.9, 97.5, 100, 95, 90];
var data=[]
var categories=[]
for(var j=0;j<histSuccess.length;j++){
   if(j==(histSuccess.length-1)){
      data.push({y:parseInt(histSuccess[j]),color:'#66ff33'})
   }else{
      data.push(parseInt(histSuccess[j]))
   }
  categories.push(j)
}
    Highcharts.chart('container', {
        chart: {
            type: 'column'
        },
        title: {
            text: 'Column chart with last column different color'
        },
        xAxis: {
            categories: categories
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Total'
            }
        },
        series: [{
            name: 'Test',
            color:'grey',
            data: data
        }]
    });
});

      </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; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials