dashboard#

class predict_backend.page.elements.dashboard.Column(elements, ratio=None)#

Bases: object

A Column vertically contains elements within a Row. A column can also contain inner rows.

Parameters:
  • elements (List[Union[Element, Row]]) – The Elements or Column.

  • ratio (Optional[List[int]]) – The relative heights of all of the elements in the Column, defaults to equal heights.

Raises:
  • ValueError – If the given ratio array is not equal the number of elements.

  • ValueError – If all rows in that column do not have the same width.

class predict_backend.page.elements.dashboard.Dashboard(content, title='', description='', orientation=None, as_columns=False, show_title=True, show_description=True, filters=None, updater=None)#

Bases: Element

A Dashboard is a way to lay out certain elements on a page. This can be done by placing those elements in rows or columns. Only Plots, Images, Infographics, and Tables can be put into Dashboards.

Parameters:
  • content (List[Union[Row, Column, Plot, PlotlyPlot, Image, Table, Infographic, RichText]]) – The list or Rows or elements that makes up a dashboard. Any lone elements in this list will be put into their own row.

  • title (str) – The title of the dashboard, defaults to “”.

  • description (str) – The description of the dashboard, defaults to “”.

  • orientation (Optional[DashboardOrientation]) – (deprecated) the Dashboard’s orientation, defaults to None.

  • as_columns (bool) – If true, reads input to dashboard as list of rows instead of columns, defaults to False.

  • show_title (bool) – Whether or not to show the title of the dashboard, defaults to True.

  • show_description (bool) – Whether or now to show the description of a dashboard, defaults to True.

  • filters (Optional[List[InputElement]]) – A list of input elements that can be used as input to the dashboard’s updater function, defaults to None.

  • updater (Optional[Callable]) – A function to provide dynamic updates to the dashboard which can use inputs from the dashboard filters, defaults to None.

Raises:
  • ValueError – If the dashboard has no content.

  • ValueError – If all rows do not have the same width.

update_item(element_title, new_element)#

This function updates an element of the dashboard, which can be used in conjunction with the dashboard’s updater function to provide dynamic page updates.

Parameters:
class predict_backend.page.elements.dashboard.Row(elements, ratio=None)#

Bases: object

A Row in a Dashboard. A Dashboard is fundamentally a list of Row s.

Parameters:
  • elements (List[Union[Element, Column]]) – A list of elements in the row. This can be any element like a Dropdown element or an inner Column inside of that Row.

  • ratio (Optional[List[int]]) – The relative widths of the elements inside the Row, defaults to all elements having the same width.

Raises:
  • ValueError – If the given ratio array is not equal the number of elements.

  • ValueError – If all columns in that row do not have the same height.

predict_backend.page.elements.dashboard.simplify(elements)#

Simplifies a Dashboard representation by replacing Row/Columns with only one element and no special ratios

Parameters:

elements (List[TypeVar(ListType)]) – The list of elements to enter a Row or Column

Return type:

List[TypeVar(ListType)]

Returns:

A simplified list that may replace an inner row or colum with the encapsulated dashboard element