shyft.dashboard.time_series.ds_view_handle

Classes

BasicDsViewHandleCreator([unit_registry, ...])

A basic implementation of a DsViewHandleCreator which uses BasicTsAdapters and supports labels and units.

DsViewHandle(*, data_source, views[, tag, ...])

This Object combines the data_source with views.

DsViewHandleCreator([unit_registry, ...])

This abstract class should be implemented in applications that need automated creation of DsViewHandles.

Exceptions

DsViewHandleError

exception shyft.dashboard.time_series.ds_view_handle.DsViewHandleError[source]

Bases: RuntimeError

class shyft.dashboard.time_series.ds_view_handle.DsViewHandle(*, data_source: DataSource, views: List[BaseView], tag: str | None = None, unit_registry: UnitRegistry | None = None)[source]

Bases: Hashable

This Object combines the data_source with views. It is used to show data in ts_viewer

__init__(*, data_source: DataSource, views: List[BaseView], tag: str | None = None, unit_registry: UnitRegistry | None = None)[source]

Initializes an immutable, hashable ds_view_handle.

Parameters:
  • data_source (unbound data source to combine with views) –

  • views (list of unbound views to view the data) –

  • tag (optional uid to identify the ds view handle later) –

  • unit_registry (optional unit_registry, is used to verify if units in data_source and views are compatible,) – should be used provided if custom defined units are used

property data_source

This property returns the data source

property views

This property returns the list with all defiend views

class shyft.dashboard.time_series.ds_view_handle.DsViewHandleCreator(unit_registry: UnitRegistry | None = None, figure_container: List[Figure] | Figure | None = None, legend_container: List[Legend] | Legend | None = None, table_container: List[Table] | Table | None = None, logger: Logger | None = None)[source]

Bases: ABC

This abstract class should be implemented in applications that need automated creation of DsViewHandles. This class should receive a data structure and create DsViewHandles to all TimeSeries contained in it. These DsViewHamndles are then sent forward, i.e. to a TsViewer or DsViewHandleRegistry.

__init__(unit_registry: UnitRegistry | None = None, figure_container: List[Figure] | Figure | None = None, legend_container: List[Legend] | Legend | None = None, table_container: List[Table] | Table | None = None, logger: Logger | None = None) None[source]
abstract create_ds_view_handles(data: Any) List[DsViewHandle][source]
get_views(unit: str, label: str, visible=True, y_axis_label: str | None = None, line_width: float | None = None, line_style: str | None = None, percentiles: List[float | statistics_property] | None = None, table_label: str | None = None, color: str | None = None) List[BaseView][source]

Auxiliary function for the creation of BaseViews for the DsViewHandles

get_y_axis_by_label(label: str)[source]

Auxiliary function for the management of YAxis by label.

get_y_axis_by_unit(unit: str | ~pint.unit.build_unit_class.<locals>.Unit) YAxis | None[source]

Auxiliary function for the management of YAxis by unit.

static get_percentiles_views(percentiles: ~typing.List[float | ~shyft.time_series._time_series.statistics_property], view_container: ~shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None) List[FillInBetween][source]

Auxiliary function for the creation of FillInBetweens

static get_time_range(tso: Quantity | TsVector | TimeSeries)[source]
class shyft.dashboard.time_series.ds_view_handle.BasicDsViewHandleCreator(unit_registry: UnitRegistry | None = None, figure_container: List[Figure] | Figure | None = None, legend_container: List[Legend] | Legend | None = None, table_container: List[Table] | Table | None = None, logger: Logger | None = None)[source]

Bases: DsViewHandleCreator

A basic implementation of a DsViewHandleCreator which uses BasicTsAdapters and supports labels and units.

__init__(unit_registry: UnitRegistry | None = None, figure_container: List[Figure] | Figure | None = None, legend_container: List[Legend] | Legend | None = None, table_container: List[Table] | Table | None = None, logger: Logger | None = None) None[source]
create_ds_view_handles(data_container: List[Quantity | TsVector | TimeSeries | Tuple[Quantity | TsVector | TimeSeries, str]]) List[DsViewHandle][source]
Parameters:

data_container – A list of TimeSeries, TsVector, or tuples containing data and label

Returns:

A list of DsViewHandles for the data