Javascript examples for highcharts:Column Chart
change color if rage is high in column chart
<html> <head> <title>highlight above/below</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.js"></script> <script type="text/javascript"> $(function(){/*from ww w . j av a2s . co m*/ var dataRaw = [5,6,8,9,8,7,4,5,6,3,2,1,4,5,3]; var low = 3; var high = 7; var dataFiltered = []; $.each(dataRaw, function(i,val) { if(val < low) { dataFiltered.push({"y":val,"color":"blue"}); } else if(val > high) { dataFiltered.push({"y":val,"color":"red"}); } else { dataFiltered.push(val); } }); var options = { chart: { type:'column', style: { fontFamily: 'Geneva, Tahoma, Verdana, sans-serif' } }, title: { text: 'Chart Test Example', style: { fontSize:'1em', fontWeight:'bold' } }, legend: { }, tooltip: { shared: true, crossHairs: true, useHTML: true }, plotOptions: { column: { color:'#ccc', groupPadding:0.05, pointPadding:0.1 }, series: { shadow: false } }, xAxis: { //categories: categories, lineColor:'#000', lineWidth:.5, tickWidth:.5, tickLength:3, tickColor:'#000', title: { text: 'X Axis', style: { color:'#000', fontSize:'.8em' } } }, yAxis: { lineColor:'#000', lineWidth:.5, tickWidth:.5, tickLength:3, tickColor:'#000', gridLineWidth:.5, gridLineColor:'#eee', title: { text: 'Y Axis', rotation:0, style: { color:'#000', fontSize:'.8em' } } }, series:[] }; $('#container').highcharts(options); var chart = $('#container').highcharts(); chart.addSeries({ name:'Series A', data:dataFiltered }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/highcharts-more.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="height:400px;margin:1.5em 1em;"></div> </body> </html>