Resize height with Highcharts

前端 未结 4 1589
清歌不尽
清歌不尽 2020-12-08 10:53

I have a Highchart which resizes the width beatuifully when the window change size. But not the height. I tried this set chart size but it\'s not working proberly. Is there

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 11:42

    Ricardo's answer is correct, however: sometimes you may find yourself in a situation where the container simply doesn't resize as desired as the browser window changes size, thus not allowing highcharts to resize itself.

    This always works:

    1. Set up a timed and pipelined resize event listener. Example with 500ms on jsFiddle
    2. use chart.setSize(width, height, doAnimation = true); in your actual resize function to set the height and width dynamically
    3. Set reflow: false in the highcharts-options and of course set height and width explicitly on creation. As we'll be doing our own resize event handling there's no need Highcharts hooks in another one.

提交回复
热议问题