def show_table(self, **kwargs): "display the table" options = {**self.options, **kwargs} if options.get("table_package", "").upper() == "PANDAS": t = self.to_dataframe()._repr_html_() html = Display.toHtml(body=t) else: t = self._getTableHtml() html = Display.toHtml(**t) if options.get("popup_window") and not options.get("button_text"): options["button_text"] = "popup " + "table" + ( (" - " + self.title) if self.title else "") + " " Display.show(html, **options) return None
def show_chart(self, **kwargs): "display the chart that was specified in the query" options = {**self.options, **kwargs} window_mode = options is not None and options.get("popup_window") if window_mode and not options.get("button_text"): options["button_text"] = "popup " + self.visualization + ( (" - " + self.title) if self.title else "") + " " c = self._getChartHtml(window_mode) if c.get("body") or c.get("head"): html = Display.toHtml(**c) Display.show(html, **options) elif c.get("fig"): if Display.notebooks_host or options.get( "notebook_app") == "jupyterlab": plotly.offline.init_notebook_mode(connected=True) plotly.offline.iplot(c.get("fig"), filename="plotlychart") else: Display.show(c.get("fig"), **options) else: return self.show_table(**kwargs)