I can dynamically set the color of a column based on data, but I can’t figure out how to change the color in the legend. Pay attention to jsfiddle, the last bar is green, but the legend is blue. Is there a way to change the color of a column and change the color of a legend?
Here is the code I use for the color of the column:
jsfiddle: http://jsfiddle.net/VCjZx/2/
function makeRun() { var divId = "container"; var current = new Array(99.95,99.96,99.97,99.98); var goal = new Array(99.965, 99.965,99.965,99.965); var quarters = new Array("Q1", "Q2", "Q3", "Q4"); var width = 495; var SizeOfFont = '14px'; var currentName = 'Quarterly %'; preprocessData = function (data, goal) { var nData = []; var colorGood = '#348017'; var colorBad = '#E42217'; var colorUse; for (var i = 0; i < data.length; i++) { if (data[i] >= goal[i]) { colorUse = colorGood; } else { colorUse = colorBad; } nData.push({ y: data[i], x: i, color: colorUse }); } return nData; }; var chart = new Highcharts.Chart({ chart: { renderTo: divId, height: 275,
source share