how to reset Highchart chart width in percentage on Button click

帅比萌擦擦* 提交于 2019-12-23 12:17:33

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!