shyft.dashboard.time_series.renderer

Functions

to_bokeh_datetime_rep(t)

for datetime axies bokeh uses ms, so we scale up time with 1000.

Classes

BackgroundDataRenderer(*, unit_registry, ...)

This object contains the meta-data and initialisation/update functions of the renderers with lines with filled color in between

BaseFigureRenderer(unit_registry, ...[, logger])

CircleScatterRenderer(*, unit_registry, ...)

This object contains meta-data and initialisation/update functions for circle scatter renderer

DiamondScatterRenderer(*, unit_registry, ...)

This object contains meta-data and initialisation/update functions for diamond scatter renderer

FillInBetweenRenderer(*, unit_registry, ...)

This object contains the meta-data and initialisation/update functions of the renderers with lines with filled color in between

LineRenderer(*, unit_registry, ...[, logger])

This object contains meta-data and initialisation/update functions for the renderers of a single line

MultiLineRenderer(*, unit_registry, ...[, ...])

This object contains meta-data and initialisation/update functions for the renderers of a MultiLine

ScatterRenderer(*, unit_registry, ...[, logger])

This object contains meta-data and initialisation/update functions for scatter renderers! All scatter renderer are i principle the same just the _glyph function is different!

SingleGlyphRenderer(*, unit_registry, ...[, ...])

This object is the base class for single glyphs such as LineRendrer and FillInBetweenRenderer

SquareScatterRenderer(*, unit_registry, ...)

This object contains meta-data and initialisation/update functions for square scatter renderer

TriangleScatterRenderer(*, unit_registry, ...)

This object contains meta-data and initialisation/update functions for triangle scatter renderer

Exceptions

RendererError

exception shyft.dashboard.time_series.renderer.RendererError[source]

Bases: RuntimeError

shyft.dashboard.time_series.renderer.to_bokeh_datetime_rep(t: ndarray) ndarray[source]

for datetime axies bokeh uses ms, so we scale up time with 1000.

class shyft.dashboard.time_series.renderer.BaseFigureRenderer(unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: Bindable, Hashable

__init__(unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]

Base renderer class for all figure renderer

Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

property calendar: Calendar

return Calendar of self.parent.parent, cached, side-effect self.time_zone== parent.parent.time_zone

y_range(view_range: UtcPeriod) ndarray[source]

This function returns an np.ndarray with min, and max y values for given view period

Parameters:

(UtcPeriod) (view_range) –

Returns:

return_array (np.ndarray)

Return type:

a numpy array with the minimum and maximum value

Notes

Returns np.nan if the renderer does not have a TS vector or a view or the time series is empty

set_view(*, view: shyft.dashboard.time_series.view.FigureView, y_axis: YAxis) None[source]

Set the view for this renderer

on_set_view() None[source]

optional Set view method which can be used in the Child classes for specialised behaviour

clear_view()[source]

Resets the render instance, removing the viewer instance and clears the sources

update_view_data(*, ts_vector: Quantity[TsVector]) None[source]

Update Renderer with new data

draw() None[source]

This function triggers a redrawing of the renderer

property visible: bool | None

Returns if renderer is visible

property ts_vector: Quantity[TsVector] | None

This property returns the unit converted ts_vector

abstract update_bokeh_data_source() None[source]

This function updates ColumnDataSource in the bokeh document

abstract reset_bokeh_data_source() None[source]

This function resets ColumnDataSource in the bokeh document

abstract property glyphs: List[Tuple[ColumnDataSource, Glyph]]

This function returns a list of tuples of the glyph and the corresponding ColumnDataSource

set_bokeh_renderers(*, bokeh_renderers: List[Any]) None[source]
get_bokeh_renderers() List[Glyph][source]
visible_callback(obj, attr, old_value, new_value) None[source]

Callback when visible of view is changed

abstract color_callback(obj, attr, old_value, new_value) None[source]

Sets the color for the bokeh patches

class shyft.dashboard.time_series.renderer.SingleGlyphRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: BaseFigureRenderer

This object is the base class for single glyphs such as LineRendrer and FillInBetweenRenderer

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

reset_bokeh_data_source()[source]

This function updates the properties of a glyph which can be dynamically set, color, fill_alpha, etc.

abstract property bokeh_ds_keys: List[str]

This function returns a list of strings of the data source keys which are in the renderer

property glyphs: List[Tuple[ColumnDataSource, Model]]

This function adds source data to bokeh glyphs

color_callback(obj, attr, old_value, new_value) None[source]

Sets the color for the bokeh patches

class shyft.dashboard.time_series.renderer.LineRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: SingleGlyphRenderer

This object contains meta-data and initialisation/update functions for the renderers of a single line

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

property bokeh_ds_keys: List[str]

This function returns the keys of the dynamically changeable properties of the renderer

on_set_view() None[source]

optional Set view method which can be used in the Child classes for specialised behaviour

update_bokeh_data_source() None[source]

This function updates the data source of the plot, data points, color, etc.

index_callback(obj, attr, old_value, new_value) None[source]
line_style_callback(obj, attr, old_value, new_value) None[source]
line_width_callback(obj, attr, old_value, new_value) None[source]
class shyft.dashboard.time_series.renderer.ScatterRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: SingleGlyphRenderer

This object contains meta-data and initialisation/update functions for scatter renderers! All scatter renderer are i principle the same just the _glyph function is different!

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

property bokeh_ds_keys: List[str]

This function returns the keys of the dynamically changeable properties of the renderer

on_set_view() None[source]

optional Set view method which can be used in the Child classes for specialised behaviour

update_bokeh_data_source() None[source]

This function updates the data source of the plot, data points, color, etc.

index_callback(obj, attr, old_value, new_value) None[source]
patch_attr_callback(obj, attr, old_value, new_value) None[source]
class shyft.dashboard.time_series.renderer.DiamondScatterRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: ScatterRenderer

This object contains meta-data and initialisation/update functions for diamond scatter renderer

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

class shyft.dashboard.time_series.renderer.CircleScatterRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: ScatterRenderer

This object contains meta-data and initialisation/update functions for circle scatter renderer

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

class shyft.dashboard.time_series.renderer.SquareScatterRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: ScatterRenderer

This object contains meta-data and initialisation/update functions for square scatter renderer

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

class shyft.dashboard.time_series.renderer.TriangleScatterRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: ScatterRenderer

This object contains meta-data and initialisation/update functions for triangle scatter renderer

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

class shyft.dashboard.time_series.renderer.FillInBetweenRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: SingleGlyphRenderer

This object contains the meta-data and initialisation/update functions of the renderers with lines with filled color in between

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

property bokeh_ds_keys: List[str]

This function keeps the keys of the dynamically changeable properties of the renderer

on_set_view() None[source]

optional Set view method which can be used in the Child classes for specialised behaviour

update_bokeh_data_source() None[source]

This function updates the data source of the plot, data points, color, etc.

indices_callback(obj, attr, old_value, new_value) None[source]
class shyft.dashboard.time_series.renderer.MultiLineRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: SingleGlyphRenderer

This object contains meta-data and initialisation/update functions for the renderers of a MultiLine

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

property bokeh_ds_keys: List[str]

This function returns the keys of the dynamically changeable properties of the renderer

on_set_view() None[source]

optional Set view method which can be used in the Child classes for specialised behaviour

update_bokeh_data_source() None[source]

This function updates the data source of the plot, data points, color, etc.

index_callback(obj, attr, old_value, new_value) None[source]
line_style_callback(obj, attr, old_value, new_value) None[source]
line_width_callback(obj, attr, old_value, new_value) None[source]
class shyft.dashboard.time_series.renderer.BackgroundDataRenderer(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None)[source]

Bases: SingleGlyphRenderer

This object contains the meta-data and initialisation/update functions of the renderers with lines with filled color in between

__init__(*, unit_registry: UnitRegistry, notify_figure_y_range_update: Callable, logger: Logger = None) None[source]
Parameters:
  • unit_registry (unit registry to use to verify data) –

  • notify_figure_y_range_update (function to trigger y_range_update of the figure renderer is connected to) –

property bokeh_ds_keys: List[str]

This function keeps the keys of the dynamically changeable properties of the renderer

on_set_view() None[source]

optional Set view method which can be used in the Child classes for specialised behaviour

update_bokeh_data_source() None[source]

This function updates the data source of the plot, data points, color, etc.

y_range(view_range: UtcPeriod) ndarray[source]

This function returns an np.ndarray with min, and max y values for given view period

It is hardcoded set in the view that self.view.no_y_rescaling = False, just in case some messes with that we return self.view.y_min, self.view.y_max if the check fails

redraw_callback(obj, attr, old_value, new_value) None[source]

Callback to redraw the renderer user for all view. variables which require a redrawing of the renderer to be effective

values_color_map_callback(obj, attr, old_value, new_value) None[source]

Callback to redraw the renderer user for all view. variables which require a redrawing of the renderer to be effective