shyft.dashboard.time_series.view

Classes

BackgroundData(*, view_container, label, unit)

This object contains all data for background data patches

BaseView(*, view_container, label[, ...])

This object represents the immutable, hashable view base which can be used as dict keys

CircleScatter(*, view_container, color, ...)

This object contains all data for diamond view

DiamondScatter(*, view_container, color, ...)

This object contains all data for diamond view

FigureView(*, view_container, color, label, ...)

This is the base class of all figure views

FillInBetween(*, view_container, color, ...)

This object contains all data for fill in between view

LegendItem(*, view_container, label, views)

This object defines the data legend view

Line(*, view_container, color, label, unit, ...)

This object contains all data for line view

MultiLine(*, view_container, colors, labels, ...)

This object contains all data for a multiple-line view.

Scatter(*, view_container, color, label, ...)

This object contains all data for a scatter view

SquareScatter(*, view_container, color, ...)

This object contains all data for diamond view

TableView(*, view_container, label, unit, ...)

This object defines the data for table view

TriangleScatter(*, view_container, color, ...)

This object contains all data for diamond view

Exceptions

ViewError

exception shyft.dashboard.time_series.view.ViewError[source]

Bases: RuntimeError

class shyft.dashboard.time_series.view.BaseView(*, view_container: shyft.dashboard.time_series.view_container.view_container_base.BaseViewContainer, label: str, visible: bool = True, tooltips: List[Tuple[str, str]] | None = None)[source]

Bases: Hashable, Bindable, AttributeCallbackManager

This object represents the immutable, hashable view base which can be used as dict keys

__init__(*, view_container: shyft.dashboard.time_series.view_container.view_container_base.BaseViewContainer, label: str, visible: bool = True, tooltips: List[Tuple[str, str]] | None = None) None[source]

Base class of all views, makes no sense to use it on its own.

Parameters:
  • view_container (view_container) –

  • label (label of the view) –

  • visible (visibility of the view) –

property view_container: shyft.dashboard.time_series.view_container.view_container_base.BaseViewContainer
class shyft.dashboard.time_series.view.LegendItem(*, view_container: shyft.dashboard.time_series.view_container.legend.Legend, label: str, views: List[BaseView], expanded: bool | None = None)[source]

Bases: BaseView

This object defines the data legend view

__init__(*, view_container: shyft.dashboard.time_series.view_container.legend.Legend, label: str, views: List[BaseView], expanded: bool | None = None) None[source]

Legend Item to show in the given legend: view_container

Parameters:
  • view_container (Legend instance where to add this legend item) –

  • label (label in the legend) –

  • views (all views which are represented by this legend item (will be used to trigger visibility)) –

Notes

One view can be in several LegendItem s but this might lead to strange behaviour

class shyft.dashboard.time_series.view.TableView(*, view_container: shyft.dashboard.time_series.view_container.table.Table, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, columns: ~typing.Dict[int, str] = None, visible: bool = True)[source]

Bases: BaseView

This object defines the data for table view

__init__(*, view_container: shyft.dashboard.time_series.view_container.table.Table, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, columns: ~typing.Dict[int, str] = None, visible: bool = True) None[source]

View defining one or more colums in the provided table, view_container,

Parameters:
  • view_container – Figure view container where to plot the renderer of the view

  • label – main label of the view

  • unit – unit of the data in the columns

  • visible – controls the visibility of all columns

  • columns – Dict[index:int, column_label:str] defines all columns a la: index of the time series in the ts_vector to add column_label of the specific column

Notes

The following values can be changed from the outside during runtime:

  • visible

  • unit

Final column labels are combined from label + column_label.

class shyft.dashboard.time_series.view.FigureView(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, renderer_class: ~typing.Type[~shyft.dashboard.time_series.renderer.BaseFigureRenderer], unit: str | ~pint.unit.build_unit_class.<locals>.Unit, no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: BaseView

This is the base class of all figure views

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, renderer_class: ~typing.Type[~shyft.dashboard.time_series.renderer.BaseFigureRenderer], unit: str | ~pint.unit.build_unit_class.<locals>.Unit, no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Base class for figure views, makes no sens to initialize this class by it self

Parameters:
  • view_container (Figure view container where to plot the renderer of the view) –

  • color (Color of the filling) –

  • label (label of the view) –

  • unit (unit of the data in the renderer) –

  • no_y_rescaling (If data should be used for y axis rescaling) –

  • visible (controls the visiblity of the renderer) –

  • y_axis (defines on which YAxis the renderer should be plotted) –

Notes

The following values can be changed from the outside during runtime:

  • color

  • label

  • unit

  • visible

property renderer_class: Type[BaseFigureRenderer]
property y_axis: YAxis
class shyft.dashboard.time_series.view.Line(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, line_style: str = 'solid', line_width: float = 2.0, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: FigureView

This object contains all data for line view

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, line_style: str = 'solid', line_width: float = 2.0, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots a line for a time series with the index in the ts-vector from the data source

Parameters:
  • view_container (Figure view container where to plot the renderer of the view) –

  • color (color of the line) –

  • label (label of the view) –

  • unit (unit of the data in the renderer) –

  • index (index defining the time series in the ts-vector) –

  • no_y_rescaling (If data should be used for y axis rescaling) –

  • visible (controls the visiblity of the renderer) –

  • y_axis (defines on which YAxis the renderer should be plotted) –

  • line_width (line width of the line) –

Notes

The following values can be changed from the outside during runtime:

color, label, unit, indices, visible

property indices: List[int]

Enables using common calls to Line and MultiLine. Should be refactored eventually.

class shyft.dashboard.time_series.view.Scatter(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, renderer_class: ~typing.Type[~shyft.dashboard.time_series.renderer.DiamondScatterRenderer] | ~typing.Type[~shyft.dashboard.time_series.renderer.CircleScatterRenderer] | ~typing.Type[~shyft.dashboard.time_series.renderer.SquareScatterRenderer] | ~typing.Type[~shyft.dashboard.time_series.renderer.TriangleScatterRenderer], no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: FigureView

This object contains all data for a scatter view

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, renderer_class: ~typing.Type[~shyft.dashboard.time_series.renderer.DiamondScatterRenderer] | ~typing.Type[~shyft.dashboard.time_series.renderer.CircleScatterRenderer] | ~typing.Type[~shyft.dashboard.time_series.renderer.SquareScatterRenderer] | ~typing.Type[~shyft.dashboard.time_series.renderer.TriangleScatterRenderer], no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots a line for a time series with the index in the ts-vector from the data source

Parameters:
  • view_container – Figure view container where to plot the renderer of the view

  • color – color of the line

  • renderer_class – defines which scatter it is going to be

  • fill_color – fill_color of the scatter

  • fill_alpha – alpha transparency of the scatter fill_color

  • line_alpha – alpha transparency of the scatter line

  • label – label of the view

  • unit – unit of the data in the renderer

  • index – index defining the time series in the ts-vector

  • no_y_rescaling – If data should be used for y axis rescaling

  • visible – controls the visibility of the renderer

  • y_axis – defines on which YAxis the renderer should be plotted

  • size – defines the size of the scatter

Notes

The following values can be changed from the outside during runtime:

color, label, unit, indices, visible, size, fill_color, fill_alpha, line_alpha

property indices: List[int]

Enables using common calls as MultiLine. Should be refactored eventually.

class shyft.dashboard.time_series.view.DiamondScatter(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: Scatter

This object contains all data for diamond view

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots a line for a time series with the index in the ts-vector from the data source

Parameters:
  • view_container – Figure view container where to plot the renderer of the view

  • color – color of the line

  • fill_color – fill_color of the scatter

  • fill_alpha – alpha transparency of the scatter fill_color

  • line_alpha – alpha transparency of the scatter line

  • label – label of the view

  • unit – unit of the data in the renderer

  • index – index defining the time series in the ts-vector

  • no_y_rescaling – If data should be used for y axis rescaling

  • visible – controls the visibility of the renderer

  • y_axis – defines on which YAxis the renderer should be plotted

  • size – defines the size of the scatter

Notes

The following values can be changed from the outside during runtime:

color, label, unit, indices, visible, size, fill_color, fill_alpha, line_alpha

class shyft.dashboard.time_series.view.CircleScatter(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: Scatter

This object contains all data for diamond view

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots a line for a time series with the index in the ts-vector from the data source

Parameters:
  • view_container – Figure view container where to plot the renderer of the view

  • color – color of the line

  • fill_color – fill_color of the scatter

  • fill_alpha – alpha transparency of the scatter fill_color

  • line_alpha – alpha transparency of the scatter line

  • label – label of the view

  • unit – unit of the data in the renderer

  • index – index defining the time series in the ts-vector

  • no_y_rescaling – If data should be used for y axis rescaling

  • visible – controls the visibility of the renderer

  • y_axis – defines on which YAxis the renderer should be plotted

  • size – defines the size of the scatter

Notes

The following values can be changed from the outside during runtime:

color, label, unit, indices, visible, size, fill_color, fill_alpha, line_alpha

class shyft.dashboard.time_series.view.SquareScatter(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: Scatter

This object contains all data for diamond view

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots a line for a time series with the index in the ts-vector from the data source

Parameters:
  • view_container – Figure view container where to plot the renderer of the view

  • color – color of the line

  • fill_color – fill_color of the scatter

  • fill_alpha – alpha transparency of the scatter fill_color

  • line_alpha – alpha transparency of the scatter line

  • label – label of the view

  • unit – unit of the data in the renderer

  • index – index defining the time series in the ts-vector

  • no_y_rescaling – If data should be used for y axis rescaling

  • visible – controls the visibility of the renderer

  • y_axis – defines on which YAxis the renderer should be plotted

  • size – defines the size of the scatter

Notes

The following values can be changed from the outside during runtime:

color, label, unit, indices, visible, size, fill_color, fill_alpha, line_alpha

class shyft.dashboard.time_series.view.TriangleScatter(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: Scatter

This object contains all data for diamond view

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, index: int, no_y_rescaling: bool | None = False, visible: bool = True, size: int = 4, fill_color: str = None, fill_alpha: float = 1.0, line_alpha: float = 1.0, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots a line for a time series with the index in the ts-vector from the data source

Parameters:
  • view_container – Figure view container where to plot the renderer of the view

  • color – color of the line

  • fill_color – fill_color of the scatter

  • fill_alpha – alpha transparency of the scatter fill_color

  • line_alpha – alpha transparency of the scatter line

  • label – label of the view

  • unit – unit of the data in the renderer

  • index – index defining the time series in the ts-vector

  • no_y_rescaling – If data should be used for y axis rescaling

  • visible – controls the visibility of the renderer

  • y_axis – defines on which YAxis the renderer should be plotted

  • size – defines the size of the scatter

Notes

The following values can be changed from the outside during runtime:

color, label, unit, indices, visible, size, fill_color, fill_alpha, line_alpha

class shyft.dashboard.time_series.view.FillInBetween(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, indices: ~typing.Tuple[int, int], no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, fill_alpha: float = 0.5, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: FigureView

This object contains all data for fill in between view

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, color: str, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, indices: ~typing.Tuple[int, int], no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, fill_alpha: float = 0.5, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots a filled patch between the data of two time series in the ts-vector from the data source

Parameters:
  • view_container (Figure view container where to plot the renderer of the view) –

  • color (Color of the filling) –

  • fill_alpha (defines the alpha value of the filling default is 0.5) –

  • label (label of the view) –

  • unit (unit of the data in the renderer) –

  • indices (tuple with 2 indices defining the 2 time series in the ts-vector) –

  • no_y_rescaling (If data should be used for y axis rescaling) –

  • visible (controls the visiblity of the renderer) –

  • y_axis (defines on which YAxis the renderer should be plotted) –

Notes

The following values can be changed from the outside during runtime:

color, fill_alpha, label, unit, indices, visible

class shyft.dashboard.time_series.view.MultiLine(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, colors: ~typing.List[str], labels: ~typing.List[str], unit: str | ~pint.unit.build_unit_class.<locals>.Unit, indices: ~typing.List[int] = None, no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, line_styles: ~typing.List[str] = None, line_widths: ~typing.List[float] = None, expandable: bool | None = False, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Bases: FigureView

This object contains all data for a multiple-line view.

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, colors: ~typing.List[str], labels: ~typing.List[str], unit: str | ~pint.unit.build_unit_class.<locals>.Unit, indices: ~typing.List[int] = None, no_y_rescaling: bool | None = False, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, line_styles: ~typing.List[str] = None, line_widths: ~typing.List[float] = None, expandable: bool | None = False, tooltips: ~typing.List[~typing.Tuple[str, str]] = None)[source]

Plots multiple lines for a time series with selected scenarios in the ts-vector from the data source

Parameters:
  • view_container (Figure view container where to plot the renderer of the view) –

  • colors (color of the line) –

  • labels (label of the view) –

  • unit (unit of the data in the renderer) –

  • indices (a list of indices defining the time series in the ts-vector) –

  • no_y_rescaling (If data should be used for y axis rescaling) –

  • visible (controls the visibility of the renderer) –

  • y_axis (defines on which YAxis the renderer should be plotted) –

  • expandable

Notes

The following values can be changed from the outside during runtime:

color, label, unit, indices, visible

class shyft.dashboard.time_series.view.BackgroundData(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, values_color_map=typing.Dict[int, str], default_color: str = 'white', index: int, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, fill_alpha: float = 0.5, y_max: int = 1000, y_min: int = -1000, show_not_defined: bool = False)[source]

Bases: FigureView

This object contains all data for background data patches

__init__(*, view_container: shyft.dashboard.time_series.view_container.figure.Figure, label: str, unit: str | ~pint.unit.build_unit_class.<locals>.Unit, values_color_map=typing.Dict[int, str], default_color: str = 'white', index: int, visible: bool = True, y_axis: ~shyft.dashboard.time_series.axes.YAxis | None = None, fill_alpha: float = 0.5, y_max: int = 1000, y_min: int = -1000, show_not_defined: bool = False)[source]

Plots the data of a time series in the ts-vector from the data source as filled background patches. Values of the time series are mapped to colors using the values_color_map.

For now only a single value to color are supported. See also example.

Parameters:
  • view_container – Figure view container where to plot the renderer of the view

  • fill_alpha – defines the alpha value of the filling default is 0.5

  • label – label of the view

  • unit – unit of the data in the renderer

  • index – index defining the time series in the ts-vector from data source to plot

  • default_color – The color everything not defined in color map should have, has only an effect if show_not_defined=True

  • show_not_defined – Show values not defined in the value_color_map with default_color

  • values_color_map – Defines the mapping from value to color to use

  • visible – controls the visibility of the renderer

  • y_axis – defines on which YAxis the renderer should be plotted

  • y_max – value to use as max value for the y axis

  • y_min – value to use as min value for the y axis

  • color

  • label

  • unit

  • index

  • visible

  • y_max

  • y_min

  • values_color_map

  • fill_alpha

  • show_not_defined