def _repr_html_(self): from IPython.display import display check_import_lux_widget() import luxWidget if (self.data is None): raise Exception( "No data is populated in Vis. In order to generate data required for the vis, use the 'refresh_source' function to populate the Vis with a data source (e.g., vis.refresh_source(df))." ) else: from lux.luxDataFrame.LuxDataframe import LuxDataFrame widget = luxWidget.LuxWidget( currentVis=LuxDataFrame.current_view_to_JSON([self]), recommendations=[], intent="") display(widget)
def _repr_html_(self): from IPython.display import display check_import_lux_widget() import luxWidget if (self.data is None): raise Exception("No data populated in View. Use the 'load' function (e.g., view.load(df)) to populate the view with a data source.") else: from lux.luxDataFrame.LuxDataframe import LuxDataFrame # widget = LuxDataFrame.render_widget(input_current_view=self,render_target="viewOnly") widget = luxWidget.LuxWidget( currentView= LuxDataFrame.current_view_to_JSON([self]), recommendations=[], context={} ) display(widget)
def renderWidget(ldf="", renderer: str = "altair", inputCurrentView=""): """ Generate a LuxWidget based on the LuxDataFrame Parameters ---------- renderer : str, optional Choice of visualization rendering library, by default "altair" inputCurrentView : lux.LuxDataFrame, optional User-specified current view to override default Current View, by default """ checkImportLuxWidget() import luxWidget widgetJSON = ldf.toJSON(inputCurrentView=inputCurrentView) return luxWidget.LuxWidget( currentView=widgetJSON["currentView"], recommendations=widgetJSON["recommendation"], context=LuxDataFrame.contextToJSON(ldf.context))
def render_widget(ldf="", renderer: str = "altair", input_current_view=""): """ Generate a LuxWidget based on the LuxDataFrame Parameters ---------- renderer : str, optional Choice of visualization rendering library, by default "altair" input_current_view : lux.LuxDataFrame, optional User-specified current vis to override default Current Vis, by default """ check_import_lux_widget() import luxWidget widgetJSON = ldf.to_JSON(input_current_view=input_current_view) return luxWidget.LuxWidget( currentVis=widgetJSON["current_vis"], recommendations=widgetJSON["recommendation"], intent=LuxDataFrame.intent_to_string(ldf.intent))
def _repr_html_(self): self._widget = None from IPython.display import display from lux.core.frame import LuxDataFrame recommendation = {"action": "Vis List", "description": "Shows a vis list defined by the intent"} recommendation["collection"] = self._collection check_import_lux_widget() import luxWidget recJSON = LuxDataFrame.rec_to_JSON([recommendation]) self._widget = luxWidget.LuxWidget( currentVis={}, recommendations=recJSON, intent="", message = "" ) display(self._widget)
def _repr_html_(self): self.widget = None from IPython.display import display from lux.luxDataFrame.LuxDataframe import LuxDataFrame # widget = LuxDataFrame.renderWidget(inputCurrentView=self,renderTarget="viewCollectionOnly") recommendation = { "action": "View Collection", "description": "Shows a view collection defined by the context" } recommendation["collection"] = self checkImportLuxWidget() import luxWidget recJSON = LuxDataFrame.recToJSON([recommendation]) self.widget = luxWidget.LuxWidget(currentView={}, recommendations=recJSON, context={}) display(self.widget)
def render_widget(self, renderer: str = "altair", input_current_vis=""): """ Generate a LuxWidget based on the LuxDataFrame Structure of widgetJSON: { 'current_vis': {}, 'recommendation': [ { 'action': 'Correlation', 'description': "some description", 'vspec': [ {Vega-Lite spec for vis 1}, {Vega-Lite spec for vis 2}, ... ] }, ... repeat for other actions ] } Parameters ---------- renderer : str, optional Choice of visualization rendering library, by default "altair" input_current_vis : lux.LuxDataFrame, optional User-specified current vis to override default Current Vis, by default """ check_import_lux_widget() import luxWidget widgetJSON = self.to_JSON(self._rec_info, input_current_vis=input_current_vis) return luxWidget.LuxWidget( currentVis=widgetJSON["current_vis"], recommendations=widgetJSON["recommendation"], intent=LuxDataFrame.intent_to_string(self._intent), message=self._message.to_html())