dashboard

class virtualitics_sdk.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.

to_json()
Return type:

dict

class virtualitics_sdk.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 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.

get_elements()
Return type:

Iterator[Union[Plot, PlotlyPlot, Image, Table, Infographic, RichText]]

get_filters()
Return type:

Iterator[InputElement]

save(link, is_ssf=False)

Save a plot serialization into a Link.

Parameters:

link (Link) – The link to save the element to.

save_col(col, link)
save_row(row, link)
set_content(content)

Validate and set content (python best practice is to set instance attributes in constructor).

Parameters:

kwargs – new content for the Element.

set_params(params)

Validate and set params (python best practice is to set instance attributes in constructor).

Parameters:

kwargs – new params for the Element.

to_json()

Convert the element to a JSON.

Return type:

dict

Returns:

A JSON dictionary of the element.

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 virtualitics_sdk.elements.dashboard.DashboardOrientation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

COLUMN = 'column'
ROW = 'row'
class virtualitics_sdk.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.

to_json()
virtualitics_sdk.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

virtualitics_sdk.elements.dashboard.valid_dashboard_element(elem_row_or_col)