I want to change the size of Highcharts legend (especially its width). Here is some of the code I tried to use based on research I did:
$(window).resize(changeSummaryLayout);
function changeSummaryLayout() {
var w = window.ierWidth;
if (w < 1370 && w > 992) {
for (i = 0; i < charts.length; i++) {
charts[i].highcharts().setTitle({ x: -5 });
charts[i].highcharts().legend.options.y = 150;
charts[i].highcharts().margin[3] = 0;
charts[i].highcharts().legend.options.width = 200;
charts[i].highcharts().legend.itemStyle.width = 200;
for (var index in charts[i].highcharts().series) {
charts[i].highcharts().legend.destroyItem(charts[i].highcharts().series[index]);
}
charts[i].highcharts().legend.render();
//charts[i].highcharts().legend.update({ itemStyle150 });
//charts[i].highcharts().isDirtyLegend = true;
//charts[i].highcharts().redraw();
//charts[i].highcharts().isDirtyBox = true;
}
$('#chartContainer').css('height', '400px');
$('.pieChartTotal').css('height', '390px');
$('.pieChartCanvasSum').css('height', '330px !important');
$('.highcharts-container').children().css('height', '330px');
$('.highcharts-background').attr('height', '330px');
}
None of those solutions is worknig to change the width and, what is strange, the width gets updated only after I hover my mouse over legend. Can anyone explain to me why does this happen?
Is there any solution that will work here?
