示例#1
0
文件: Vis.py 项目: smritim/lux
 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)
示例#2
0
文件: View.py 项目: 19thyneb/lux
	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)
示例#3
0
 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))
示例#4
0
 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))
示例#5
0
	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)	
示例#6
0
    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)
示例#7
0
文件: frame.py 项目: JLian401/lux
    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())