Dynamically adding charts to the webpage

I have the situation where I
o first need to create a div object
o than append the chart to it and
o then add the div somewhere in the body of the html document.

Doing so creates a canvas of size 0 since the offsetwidth and offsetheight of the div are 0 since they seam to be only calculated correctly when the page is fully rendered. And this again ends up in the graph not being rendered properly :smiling_imp:

How can I overcome this problem?

Here is an html example to reproduce the problem.

…

...

Chart has to be created in the visible container, i.e. after it was attached to a body.