JavaScript
(function(H) {
H.wrap(H.Legend.prototype, 'colorizeItem', function(proceed, item, visible) {
var color = item.color;
item.color = item.options.legendColor;
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
item.color = color;
});
}(Highcharts));
Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Seasonal Change'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
colorByPoint: true
}
},
series: [{
name: 'This year',
legendColor: 'pink',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
colors: ['#336699', '#336699', '#669933', '#669933', '#669933', '#996666', '#996666', '#996666', '#999933', '#999933', '#999933', '#336699']
},
{
name: 'Last year',
legendColor: 'purple',
data: [19.9, 81.5, 96.4, 119.2, 154.0, 166.0, 145.6, 158.5, 226.4, 184.1, 99.6, 56.4],
colors: ['#6699CC', '#6699CC', '#99CC66', '#99CC66', '#99CC66', '#CC9999', '#CC9999', '#CC9999', '#CCCC66', '#CCCC66', '#CCCC66', '#6699CC']
}
]
});