Chart height increases whenever the windows is resized when we use `height: '100%'`
See original GitHub issueBug report
Codepen
Here is the codepen.
Explanation
When we have height: '100%'
, whenever the window is resized the chart height increases. You can see this in the codepen above by simply restoring down/maximizing the browser or by resizing the window.
In my own app, the height keeps on increasing forever after the first resize, I couldn’t repro this in the codepen. Here’s a gif of the problem from my app:
I know that there’s this in the docs:
Note: If you provide a percentage value '100%', make sure to have a fixed height parent.
But isn’t using flex like that supposed to work? There’s no way I can give an explicit height to the parent, this just isn’t feasible when doing flexible layouts.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Height of the div is not proper when resizing the window
Then to let the div grow with the window height, use height: 100% or whatever percentage of the window height you need the...
Read more >DIV tags with 100% relative height not resized - Microsoft Learn
The DIV tag stays at the initial absolute height of the table and will not be resized automatically.
Read more >WebGL Resizing the Canvas.
Here's what you need to know to change the size of the canvas. Every canvas has 2 sizes. The size of its drawingbuffer....
Read more >Changing the Size and Type | FusionCharts
When the container size changes, the chart is automatically resized accordingly. Set Width and Height in Pixels#. To set the width and height...
Read more >Charts aren't full-size until page is refreshed - CanvasJS.com
I 'm using some charts in a 3dcart-hosted site. ... Whenever the window size changes the chart checks to see if the parent...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, I still have this issue. I have parent container set to fixed height of 40vh and charts height set to 100% and It is still growing in size. The property min-height is still there and is probably causing the problem. I am using version 3.35.0.
Sure, I have fixed it by removing
minHeight
to container when the height is ‘100%’.In case, there is not enough padding at the bottom of the chart, you will have to manually add some padding. This will be the only caveat when using
height: 100%