问题
I want to change highchart's width on button click, I know I can do it using chart.setSize
function, but it sets the width only in pixels. But I need to set the width in percentage.
Here is the sample JSFiddle, in which I have tried to reset the width in 3 ways. Only Button 1 works, but not the remaining 2.
Please let me know how can I reset the width in percentage.
回答1:
you could do it like button4
here :
var chart = $('#container').highcharts();
var el = $('.chart-inner');
el.css('width','100%');
chart.setSize(el.width(),el.height(),true);
来源:https://stackoverflow.com/questions/17359805/how-to-reset-highchart-chart-width-in-percentage-on-button-click