Layout#

class lumen.layout.Layout(*, auto_update, description, download, facet, layout, refresh_rate, reloadable, rerender, show_title, source, title, tsformat, views, name)#

Layout renders one or more lumen.views.base.View components into a layout.

Additionally it provides functionality for facetting the lumen.views.base.View objects by grouping the data along some dimension.


Parameters#

auto_update

type: bool
default: True
Whether changes in filters, transforms and references automaticallytrigger updates in the data or whether an update has to be triggeredmanually using the update event or the update button in the UI.

description

type: str
default: None
A description about the app will be added to the top of the sidebar

download

type: lumen.layout.Download
default: Download()
The download objects determines whether and how the source tablescan be downloaded.

facet

type: lumen.layout.Facet
default: None
The facet object determines whether and how to facet the cardson the layout.

layout

type: str | list | dict
default: 'column'
Defines the layout of the views in the monitor layout. Can be’column’, ‘row’, ‘grid’, ‘row’ or a nested list of indexescorresponding to the views, e.g. [[0, 1], [2]] will createa Column of one row containing views 0 and 1 and a second Rowcontaining view 2.

name

type: str
default: 'Layout'
String identifier for this object.

refresh_rate

type: int
default: None
bounds: None
How frequently to refresh the monitor by querying the adaptor.

reloadable

type: bool
default: True
Whether to allow reloading data layout’s source using a button.

rerender

type: bool
default: False
An event that is triggered whenever the View requests a re-render.

show_title

type: bool
default: True
Whether to show the title in Card headers.

source

type: lumen.Source
default: None
The Source queries the data from some data source.

title   required

type: str
default: ''
A title for this Layout.

tsformat

type: str
default: '%m/%d/%Y %H:%M:%S'

views   required

type: list | dict
default: None
List or dictionary of View specifications.


Methods#

Layout.get_cards() List[Card]#
Layout.get_filter_panel(skip=None, apply_button: bool = True) Column#
Layout.servable(title: str | None = None, location: bool | 'Location' = True, area: str = 'main', target: str | None = None) Viewable#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters:
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type:

The Panel object itself

Layout.show(title: str | None = None, port: int = 0, address: str | None = None, websocket_origin: str | None = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) threading.Thread | 'Server'#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters:
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns:

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type:

bokeh.server.Server or panel.io.server.StoppableThread

Layout.start(event: Event | None = None)#

Starts any periodic callback instantiated on this object.

Layout.to_spec(context: Dict[str, Any] | None = None) Dict[str, Any]#

Exports the full specification to reconstruct this component.

Parameters:

context (Dict[str, Any]) – Context contains the specification of all previously serialized components, e.g. to allow resolving of references.

Return type:

Declarative specification of this component.

Layout.update(*events: Event, clear_cache: bool = True)#

Updates the views on this layout by clearing any caches and rerendering the views on this Layout.