How To Toggle Legend Layout In Highchart
I am interested to change legend layout on click event as below 1st click horizontal - bottom 2nd click horizontal top 3rd click virtical left 4th click virtical right Here is Link
Solution 1:
Here's a way to do it here. I hate resorting to setting the internal dirty
flags but it seems to work well:
var somePositions = [['center','bottom'],
['center','top'],
['left','middle'],
['right','middle']];
$('#btn').click(function(){
posIdx++;
if (posIdx == 4) posIdx = 0;
chart.legend.options.align = somePositions[posIdx][0];
chart.legend.options.verticalAlign = somePositions[posIdx][1];
chart.isDirtyLegend = true;
chart.isDirtyBox = true;
chart.redraw();
});
Post a Comment for "How To Toggle Legend Layout In Highchart"