DOM is not ready when I need to insert chart