Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Highcharts not loading to width of the parent div #5783
Chart loads in the same size as the parent.
Chart always exceeds the parent div onload.
Live demo with steps to reproduce
If you render the chart in a JQuery Element in memory then add that element to the page there's an issue with chart sizing post v5.0.10.
Important to note, in the repro, if you resize the browser, the chart then sizes itself correctly for some reason. I believe reinforces what the original poster was commenting on where if they called the initialization function again then it rendered correctly.
referenced this issue
Jun 21, 2017
This happens because in v5.0.10, the container was first moved to a temporary div in the document, then the chart rendered. In v5.0.11 we reformatted it to preserve the DOM structure but rather temporary display all elements in order to read the text bounding boxes. That's why it doesn't work correctly now, because the container is detached from the DOM all the way.
Here's a demo without jQuery: http://jsfiddle.net/highcharts/3z0stcfe/1/