Highcharts Demo
author(s):
Torstein Hønsi
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 300px"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
events: {
load: function() {
var chart = this;
$.each(chart.legend.allItems, function(i, item){
var $check = $(item.checkbox),
left = parseFloat($check.css('left')),
label = item.legendItem,
static = 30;
$check.css({
left: (left - label.bBox.width - static) + 'px'
});
console.log(label, item, $check);
});
}
}
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
marker: {
enabled: false
},
allowPointSelect: true,
showCheckbox: true
}
},
legend: {
symbolPadding: 20,
symbolWidth: 0
},
series: [{
name: 's 1',
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]
},{
name: 'another name',
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].sort(function(a,b) { return a - b; })
}]
});
});