user1470957
user1470957

Reputation: 461

Highchart legend

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

Answers (2)

Sebastian Bochan
Sebastian Bochan

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

yuk
yuk

Reputation: 933

You can hide legend with pagination like this:

$('.highcharts-legend').hide();

Upvotes: 1

Related Questions