1
votes

Using Highstocks 1.2.4.

By configuration the overall legend is enabled while the showInLegend option for all series are enabled. So the legend is not display play default fine....how can I enable/display the legend by clicking on a button?

chart.options.legend.enabled = true
chart.redraw()
chart.legend.render()

has no effect.

2

2 Answers

0
votes

The best way that I found:

$("#remove").click(function() {

item.options.showInLegend = false;
item.legendItem = null;
chart.legend.destroyItem(item);
chart.legend.render();

});

Read the complet example

http://jsfiddle.net/jugal/MtwGc/

-1
votes

You can use this construction

$('#btn').click(function() {
            chart.options.legend.enabled = true;
            chart.options.legend = new Highcharts.Legend(chart);
            chart.redraw();
        });

http://jsfiddle.net/grNfK/1/