def render(self, path="render.html"): """ Produce rendered charts in a html file :param path: :return: """ template_name = "multicharts.html" chart_content = self.render_embed() dependencies = self._merge_dependencies() script_list = produce_html_script_list(dependencies) tmp = template.JINJA2_ENV.get_template(template_name) html = tmp.render(multi_chart_content=chart_content, script_list=script_list) html = utils.freeze_js(html) utils.write_utf8_html_file(path, html)
def render(self, path="render.html"): """ Render the options dict, generate the html file :param path: path of render html file """ _tmp = "local.html" my_option = json_dumps(self._option, indent=4) tmp = template.JINJA2_ENV.get_template(_tmp) script_list = template.produce_html_script_list(self._js_dependencies) html = tmp.render(myOption=my_option, chart_id=self._chart_id, script_list=script_list, myWidth=self._width, myHeight=self._height) html = template.freeze_js(html) template.write_utf8_html_file(path, html)
def render(self, path="render.html"): """ 渲染配置项并生成 html 文件 :param path: 文件保存路径 """ _tmp = "local.html" my_option = json_dumps(self._option, indent=4) tmp = template.JINJA2_ENV.get_template(_tmp) script_list = template.produce_html_script_list(self._js_dependencies) html = tmp.render(my_option=my_option, chart_id=self._chart_id, script_list=script_list, page_title=self._page_title, my_width=self.width, my_height=self.height) html = utils.freeze_js(html) utils.write_utf8_html_file(path, html)
def get_js_dependencies(self): """ Declare its javascript dependencies for embedding purpose """ return template.produce_html_script_list(self._js_dependencies)
def get_js_dependencies(self): """ Declare its javascript dependencies for embedding purpose """ unordered_js_dependencies = self._merge_dependencies() return produce_html_script_list(unordered_js_dependencies)
def get_js_dependencies(self): """ 声明所有的 js 文件路径 """ return template.produce_html_script_list(self._js_dependencies)