How to define views#

What does this guide solve?

This guide will show you how to define views on your dashboard

Overview#

A view is the final output of a dashboard, but to be able to create a view, at least one data Source is needed. The following example source is a table containing data about individual penguins with various measurements. This source could have been filtered or transformed but is omitted to keep the example simple.

The views are located in the layouts area and can take the form of various visual components. Lumen includes many View types and is built so that you can easily use components from the Holoviz ecosystem, such as a scatter plot from hvPlot or an indicator from Panel.

Below is an example of two views of the same data - a scatter plot and a table.

sources:
  penguin_source:
    type: file
    tables:
      penguin_table: https://datasets.holoviz.org/penguins/v1/penguins.csv

layouts:
  - title: Table
    source: penguin_source
    views:
      - type: hvplot
        table: penguin_table
        kind: scatter
        color: species
      - type: table
        table: penguin_table
import panel as pn
from lumen.pipeline import Pipeline
from lumen.views import Table, hvPlotView

pn.extension("tabulator")

data_url = "https://datasets.holoviz.org/penguins/v1/penguins.csv"
pipeline = Pipeline.from_spec(
    {
        "source": {"type": "file", "tables": {"penguin_table": data_url}},
    }
)

pn.Column(hvPlotView(pipeline=pipeline), Table(pipeline=pipeline))

To arrange the Lumen dashboard views in Python, use Panel, as shown here.