how to reset Highchart chart width in percentage on Button click

10,246

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);
Share:
10,246

Related videos on Youtube

shaaaa
Author by

shaaaa

Updated on October 09, 2022

Comments

  • shaaaa
    shaaaa over 1 year

    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.