Highcharts Demo
author(s):
Torstein Hønsi
by J. Albert Bowden
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
<button id="updateLegend">Remove Legend</button>
<div id="legendMessage"></div>
JavaScript
$(function () {
var chart = $('#container').highcharts({
chart: {},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
margin: 60
}
},
legend: {
enabled: true,
align: 'right',
verticalAlign: 'middle'
},
credits: {
enabled: false
},
series: [{
data: [29900, 71500, 106400, 129200, 144000, 176000, 135600, 148500, 216400, 194100, 95600, 54400]
}]
},function(chart){
$('#updateLegend').click(function (e) {
var legend = chart.legend;
if(legend.display) {
legend.group.hide();
legend.box.hide();
legend.display = false;
} else {
legend.group.show();
legend.box.show();
legend.display = true;
}
});
});
});