def _repr_html_(self): """ 渲染配置项并将图形显示在 notebook 中 """ dom = self._render_notebook_dom_() component = self._render_notebook_component_() require_config = CURRENT_CONFIG.produce_require_configuration( self._js_dependencies, CURRENT_CONFIG.get_current_jshost_for_jupyter(jshost=self._jshost)) return engine.render('notebook.html', single_chart=component, dom=dom, **require_config)
def _repr_html_(self): """ 渲染配置项并将图形显示在 notebook 中 chart/page => charts chart.js_dependencies => require_config => config_items, libraries :return A unicode string. """ if CURRENT_CONFIG.jupyter_presentation == constants.DEFAULT_HTML: require_config = CURRENT_CONFIG.produce_require_configuration( self.js_dependencies) config_items = require_config["config_items"] libraries = require_config["libraries"] env = engine.create_default_environment(constants.DEFAULT_HTML) return env.render_chart_to_notebook(charts=(self, ), config_items=config_items, libraries=libraries) elif CURRENT_CONFIG.jupyter_presentation == constants.NTERACT: env = engine.create_default_environment(constants.DEFAULT_HTML) return env.render_chart_to_notebook(chart=self, template_name="nteract.html") else: return None
def _repr_html_(self): """ 渲染配置项并将图形显示在notebook中, 覆盖基类中的该函数,通过读取'notebook.html'文件后,向模板中增加变量的方式,来设置tooltip提示信息 chart/page => charts chart.js_dependencies => require_config => config_items, libraries :return A unicode string. """ if CURRENT_CONFIG.jupyter_presentation != constants.DEFAULT_HTML: return None require_config = CURRENT_CONFIG.produce_require_configuration( self.js_dependencies ) config_items = require_config["config_items"] libraries = require_config["libraries"] env = engine.create_default_environment(constants.DEFAULT_HTML) # return env.render_chart_to_notebook( # charts=(self,), config_items=config_items, libraries=libraries # ) cont = env.render_chart_to_notebook( charts=(self,), config_items=config_items, libraries=libraries ) tooltip_script = """<script>\nvar columns_list = {0};\n</script>""".format(self.my_option['columns_list']) cont += tooltip_script # print(cont) return cont
def _repr_html_(self): """ :return: html content for jupyter """ dependencies = self.js_dependencies require_config = CURRENT_CONFIG.produce_require_configuration( dependencies) config_items = require_config["config_items"] libraries = require_config["libraries"] env = engine.create_default_environment(constants.DEFAULT_HTML) return env.render_chart_to_notebook(charts=self, config_items=config_items, libraries=libraries)
def _repr_html_(self): """ :return: html content for jupyter """ dependencies = self.js_dependencies require_config = CURRENT_CONFIG.produce_require_configuration( dependencies ) config_items = require_config["config_items"] libraries = require_config["libraries"] env = engine.create_default_environment(constants.DEFAULT_HTML) return env.render_chart_to_notebook( charts=self, config_items=config_items, libraries=libraries )
def _repr_html_(self): """ 渲染配置项并将图形显示在 notebook 中 chart/page => charts chart.js_dependencies => require_config => config_items, libraries :return A unicode string. """ require_config = CURRENT_CONFIG.produce_require_configuration( self.js_dependencies) config_items = require_config['config_items'] libraries = require_config['libraries'] env = engine.create_default_environment() return env.render_chart_to_notebook(charts=(self, ), config_items=config_items, libraries=libraries)
def _repr_html_(self): """ :return: """ dependencies = self.js_dependencies require_config = CURRENT_CONFIG.produce_require_configuration( dependencies) config_items = require_config['config_items'] libraries = require_config['libraries'] env = engine.create_default_environment() return env.render_chart_to_notebook(charts=self, config_items=config_items, libraries=libraries)
def _repr_html_(self): """ :return: """ doms = components = "" dependencies = self.js_dependencies for chart in self: doms += chart._render_notebook_dom_() components += chart._render_notebook_component_() require_config = CURRENT_CONFIG.produce_require_configuration( dependencies) return engine.render_notebook("notebook.html", single_chart=components, dom=doms, **require_config)
def _repr_html_(self): """ 渲染配置项并将图形显示在 notebook 中 chart/page => charts chart.js_dependencies => require_config => config_items, libraries :return A unicode string. """ if CURRENT_CONFIG.jupyter_presentation != constants.DEFAULT_HTML: return None require_config = CURRENT_CONFIG.produce_require_configuration( self.js_dependencies ) config_items = require_config["config_items"] libraries = require_config["libraries"] env = engine.create_default_environment(constants.DEFAULT_HTML) return env.render_chart_to_notebook( charts=(self,), config_items=config_items, libraries=libraries )
def get_js_dependencies(self): """ 声明所有的 js 文件路径 """ return CURRENT_CONFIG.produce_html_script_list(self._js_dependencies)
def _add_chinese_map(self, map_name_in_chinese): name_in_pinyin = CURRENT_CONFIG.chinese_to_pinyin(map_name_in_chinese) self._js_dependencies.add(name_in_pinyin)
def get_js_dependencies(self): """ Declare its javascript dependencies for embedding purpose """ return CURRENT_CONFIG.produce_html_script_list(self.js_dependencies)
def get_js_dependencies(self): """ Declare its javascript dependencies for embedding purpose """ return CURRENT_CONFIG.produce_html_script_list(self.js_dependencies)
def _add_chinese_map(self, map_name_in_chinese): name_in_pinyin = CURRENT_CONFIG.chinese_to_pinyin(map_name_in_chinese) self._js_dependencies.add(name_in_pinyin)
def get_js_dependencies(self): """ 声明所有的 js 文件路径 """ return CURRENT_CONFIG.produce_html_script_list(self._js_dependencies)