Moved chart creation script inside a jinja2 template block