Reputation: 461
I added a button to my chart to toggle (show/hide) the chart legend.
To hide my legend, I'm using in the callback function:
legend.group.hide()
Legend.box.hide()
This is working great, but when the legend is hidden, the legend pagination (legend paging navigation) remain visible on the chart. How can I also hide the legend navigation?
Upvotes: 1
Views: 1252
Reputation: 37578
You need to refer to down/up/pager objects and hide them too.
$('#updateLegend').click(function (e) {
var legend = chart.legend;
if(legend.display) {
legend.group.hide();
legend.down.hide();
legend.up.hide();
legend.pager.hide();
legend.display = false;
} else {
legend.group.show();
legend.down.show();
legend.up.show();
legend.pager.show();
legend.display = true;
}
});
Example: http://jsfiddle.net/3Bh7b/124/
Upvotes: 0
Reputation: 933
You can hide legend with pagination like this:
$('.highcharts-legend').hide();
Upvotes: 1