How to reset the width of a Highchart chart in percent when a button is clicked

I want to change the highchart width when I click the button, I know that I can do this with the chart.setSize function, but it sets the width in pixels only. But I need to set the width in percent .

Here is a JSFiddle sample in which I tried using reset width in three ways. Only button 1 works, but not the other 2.

Please let me know how I can reset to use the width in percent .

+4
source share
1 answer

you can do it like button4 here :

  var chart = $('#container').highcharts(); var el = $('.chart-inner'); el.css('width','100%'); chart.setSize(el.width(),el.height(),true); 
+7
source

Source: https://habr.com/ru/post/1488636/


All Articles