Views¶
lumen.views
¶
base
¶
The View classes render the data returned by a Pipeline as a Panel object.
DOWNLOAD_FORMATS = ['csv', 'xlsx', 'json', 'parquet']
module-attribute
¶
AltairView
¶
Bases:
AltairView provides a declarative way to render Altair charts.
chart = param.Dict(default={}, doc='Keyword argument for Chart.')
class-attribute
instance-attribute
¶
encode = param.Dict(default={}, doc='Keyword arguments for encode.')
class-attribute
instance-attribute
¶
mark = param.Dict(default={}, doc='Keyword arguments for mark.')
class-attribute
instance-attribute
¶
marker = param.Selector(default='line', objects=['area', 'bar', 'boxplot', 'circle', 'errorband', 'errorbar', 'geoshape', 'image', 'line', 'point', 'rect', 'rule', 'square', 'text', 'tick', 'trail'])
class-attribute
instance-attribute
¶
project = param.Dict(doc='Keyword arguments for project.')
class-attribute
instance-attribute
¶
properties = param.Dict(doc='Keyword arguments for properties.')
class-attribute
instance-attribute
¶
transform = param.Dict(doc="\n Keyword arguments for transforms, nested by the type of\n transform, e.g. {'bin': {'as_': 'binned', 'field': 'x'}}.")
class-attribute
instance-attribute
¶
view_type = 'altair'
class-attribute
instance-attribute
¶
x = param.Selector(doc='The column to render on the x-axis.')
class-attribute
instance-attribute
¶
y = param.Selector(doc='The column to render on the y-axis.')
class-attribute
instance-attribute
¶
get_panel()
¶
DownloadView
¶
Bases:
DownloadView renders a button that allows downloading data as CSV, Excel, and parquet files.
filename = param.String(default='data', doc='\n Filename of the downloaded file.')
class-attribute
instance-attribute
¶
format = param.Selector(default=None, objects=DOWNLOAD_FORMATS, doc='\n The format to download the data in.')
class-attribute
instance-attribute
¶
icon = param.String(default='file-spreadsheet', doc='\n Icon to show on the button.')
class-attribute
instance-attribute
¶
kwargs = param.Dict(default={}, doc='\n Keyword arguments passed to the serialization function, e.g.\n data.to_csv(file_obj, **kwargs).')
class-attribute
instance-attribute
¶
view_type = 'download'
class-attribute
instance-attribute
¶
get_panel()
¶
GraphicWalker
¶
Bases:
Renders the data using the GraphicWalker panel extension.
ignore_limit = param.Boolean(default=False, doc='\n Ignore any SQLLimit transform defined on the input pipeline.')
class-attribute
instance-attribute
¶
kernel_computation = param.Boolean(default=False, doc="If True the computations will take place on the server or in the Jupyter kernel\n instead of the client to scale to larger datasets. Default is False. In Pyodide this will\n always be set to False. The 'chart' renderer will only work with client side rendering.")
class-attribute
instance-attribute
¶
renderer = param.Selector(default='profiler', objects=['explorer', 'profiler', 'viewer', 'chart'], doc="How to display the data. One of 'explorer' (default), 'profiler,\n 'viewer' or 'chart'.")
class-attribute
instance-attribute
¶
tab = param.Selector(default='data', objects=['data', 'vis'], doc="Set the active tab to 'data' or 'vis' (default). Only applicable for the 'explorer' renderer. Not bi-directionally synced with client.")
class-attribute
instance-attribute
¶
view_type = 'graphic_walker'
class-attribute
instance-attribute
¶
get_panel()
¶
HoloViews
¶
Bases:
HoloViews renders the data as a HoloViews plot.
object = param.Parameter()
class-attribute
instance-attribute
¶
streaming = param.Boolean(default=False, doc='\n Whether to stream new data to the plot or rerender the plot.')
class-attribute
instance-attribute
¶
view_type = 'holoviews'
class-attribute
instance-attribute
¶
from_spec(spec, source=None, filters=None, pipeline=None)
classmethod
¶
get_panel()
¶
to_spec(context=None)
¶
IndicatorView
¶
Bases:
IndicatorView renders the latest field value as a Panel Indicator.
indicator = param.Selector(objects=_INDICATORS, doc='\n The name of the panel Indicator type.')
class-attribute
instance-attribute
¶
label = param.String(doc='\n A custom label to use for the Indicator.')
class-attribute
instance-attribute
¶
view_type = 'indicator'
class-attribute
instance-attribute
¶
get_panel()
¶
Panel
¶
Bases:
Panel views provide a way to declaratively wrap a Panel component.
The Panel View is a very general purpose view that allows
expressing arbitrary Panel objects as a specification. The Panel
specification may be arbitrarily nested making it possible to
specify entire layouts. Additionally the Panel specification also
supports references, including standard source and variable
references and a custom $data reference that inserts the current
data of the View.
PerspectiveView
¶
Bases:
PerspectiveView renders data into a Perspective widget.
See https://panel.holoviz.org/reference/panes/Perspective.html for more details.
aggregates = param.Dict(None, allow_None=True, doc='\n How to aggregate. For example {x: "distinct count"}')
class-attribute
instance-attribute
¶
column_pivots = param.ListSelector(None, allow_None=True, doc='\n A list of source columns to pivot by. For example ["x", "y"]')
class-attribute
instance-attribute
¶
columns = param.ListSelector(default=None, allow_None=True, doc='\n A list of source columns to show as columns. For example ["x", "y"]')
class-attribute
instance-attribute
¶
computed_columns = param.ListSelector(default=None, allow_None=True, doc='\n A list of computed columns. For example [""x"+"index""]')
class-attribute
instance-attribute
¶
filters = param.List(default=None, allow_None=True, doc='\n How to filter. For example [["x", "<", 3],["y", "contains", "abc"]]')
class-attribute
instance-attribute
¶
plugin = param.Selector(default=(_PerspectivePlugin.GRID.value), objects=(_PerspectivePlugin.options()), doc='\n The name of a plugin to display the data. For example hypergrid or d3_xy_scatter.')
class-attribute
instance-attribute
¶
row_pivots = param.ListSelector(default=None, allow_None=True, doc='\n A list of source columns to group by. For example ["x", "y"]')
class-attribute
instance-attribute
¶
selectable = param.Boolean(default=True, allow_None=True, doc='\n Whether items are selectable.')
class-attribute
instance-attribute
¶
sort = param.List(default=None, doc='\n How to sort. For example[["x","desc"]]')
class-attribute
instance-attribute
¶
theme = param.Selector(default='material', objects=_PERSPECTIVE_THEMES, doc='\n The style of the PerspectiveViewer. For example material-dark')
class-attribute
instance-attribute
¶
view_type = 'perspective'
class-attribute
instance-attribute
¶
get_panel()
¶
StringView
¶
Table
¶
Bases:
Table renders data using the powerful Panel Tabulator component.
See https://panel.holoviz.org/reference/widgets/Tabulator.html
VegaLiteView
¶
View
¶
Bases: ,
View components provide a visual representation for the data returned
by a :class:lumen.source.base.Source or :class:lumen.pipeline.Pipeline.
The View must return a Panel object or an object that can be
rendered by Panel. The base class provides methods which query the
the provided :class:lumen.pipeline.Pipeline.
Subclasses should use these methods to query the data and return
a Viewable Panel object in the get_panel method.
control_panel
property
¶
controls = param.List(default=[], doc='\n Parameters that should be exposed as widgets in the UI.')
class-attribute
instance-attribute
¶
download = param.ClassSelector(class_=Download, default=(Download()), doc='\n The download objects determines whether and how the source tables\n can be downloaded.')
class-attribute
instance-attribute
¶
field = param.Selector(doc='The field being visualized.')
class-attribute
instance-attribute
¶
kwargs = {k: v for k, v in (params.items()) if k not in self.param}
instance-attribute
¶
limit = param.Integer(default=None, bounds=(0, None), doc='\n Limits the number of rows that are rendered.')
class-attribute
instance-attribute
¶
loading_indicator = param.Boolean(default=True, constant=True, doc='\n Whether to display a loading indicator on the View when the\n Pipeline is refreshing the data.')
class-attribute
instance-attribute
¶
panel
property
¶
pipeline = param.ClassSelector(class_=Pipeline, doc='\n The data pipeline that drives the View.')
class-attribute
instance-attribute
¶
rerender = param.Event(default=False, doc='\n An event that is triggered whenever the View requests a re-render.')
class-attribute
instance-attribute
¶
selection_group = param.String(default=None, doc='\n Declares a selection group the plot is part of. This feature\n requires the separate HoloViews library.')
class-attribute
instance-attribute
¶
title = param.String(default=None, doc='\n The title of the view.')
class-attribute
instance-attribute
¶
view_type = None
class-attribute
¶
from_spec(spec, source=None, filters=None, pipeline=None)
classmethod
¶
Resolves a View specification given the schema of the Source it will be filtering on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
|
Specification declared as a dictionary of parameter values. |
required |
source
|
The Source object containing the tables the View renders. |
None
|
|
filters
|
A list of Filter objects which provide query values for the Source. |
None
|
|
pipeline
|
The Lumen pipeline driving this View. Must not be supplied if the spec contains a pipeline definition or reference. |
None
|
Returns:
| Type | Description |
|---|---|
The resolved View object.
|
|
get_data()
¶
Queries the Source for the specified table applying any
filters and transformations specified on the View. Unlike
get_value this should be used when multiple return values
are expected.
Returns:
| Type | Description |
|---|---|
|
The queried table after filtering and transformations are applied. |
get_panel()
¶
Constructs and returns a Panel object which will represent a view of the queried table.
Returns:
| Type | Description |
|---|---|
|
A Panel Viewable object representing a current representation of the queried table. |
get_value(field=None)
¶
Queries the Source for the data associated with a particular
field applying any filters and transformations specified on
the View. Unlike get_data this method returns a single
scalar value associated with the field and should therefore
only be used if only a single.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field
|
|
The field from the table to return; if None uses field defined on the View. |
None
|
Returns:
| Type | Description |
|---|---|
|
A single scalar value representing the current value of the queried field. |
to_spec(context=None)
¶
Exports the full specification to reconstruct this component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
|
Context contains the specification of all previously serialized components, e.g. to allow resolving of references. |
None
|
Returns:
| Type | Description |
|---|---|
Declarative specification of this component.
|
|
update(*events, invalidate_cache=True)
¶
Triggers an update in the View.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
|
param events that may trigger an update. |
()
|
invalidate_cache
|
|
Whether to clear the View's cache. |
True
|
YdataProfilingView
¶
hvOverlayView
¶
hvPlotBaseView
¶
Bases:
by = param.ListSelector(doc='The column(s) to facet the plot by.')
class-attribute
instance-attribute
¶
geo = param.Boolean(default=False, doc='Toggle True if the plot is on a geographic map.')
class-attribute
instance-attribute
¶
groupby = param.ListSelector(doc='The column(s) to group by.')
class-attribute
instance-attribute
¶
kind = param.Selector(default=None, doc="The kind of plot, e.g. 'scatter' or 'line'.", objects=['area', 'bar', 'barh', 'bivariate', 'box', 'contour', 'contourf', 'errorbars', 'hist', 'image', 'kde', 'labels', 'line', 'scatter', 'heatmap', 'hexbin', 'ohlc', 'points', 'step', 'violin'])
class-attribute
instance-attribute
¶
x = param.Selector(doc='The column to render on the x-axis.')
class-attribute
instance-attribute
¶
y = param.Selector(doc='The column to render on the y-axis.')
class-attribute
instance-attribute
¶
hvPlotUIView
¶
hvPlotView
¶
Bases:
hvPlotView renders the queried data as a bokeh plot generated with hvPlot.
hvPlot allows for a concise but powerful declaration of a plot via its simple API.
operations = param.List(item_type=(param.ParameterizedFunction), doc='\n Operations to apply to HoloViews plot.')
class-attribute
instance-attribute
¶
opts = param.Dict(default={}, doc='HoloViews options to apply on the plot.')
class-attribute
instance-attribute
¶
selection_expr = param.Parameter(doc='\n A selection expression caputirng the current selection applied\n on the plot.')
class-attribute
instance-attribute
¶
streaming = param.Boolean(default=False, doc='\n Whether to stream new data to the plot or rerender the plot.')
class-attribute
instance-attribute
¶
view_type = 'hvplot'
class-attribute
instance-attribute
¶
get_panel()
¶
get_plot(df)
¶
update(*events, invalidate_cache=True)
¶
Triggers an update in the View.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
param events that may trigger an update. |
()
|
|
invalidate_cache
|
|
Whether to clear the View's cache. |
True
|