shyft.dashboard.time_series.axes

Classes

FigureYAxis(*, axis, unit_registry[, ...])

This Object represents actual y axis for a Figure class

YAxis(*, label, unit[, color, side, ...])

This object represents the y axis definition

YAxisSide(*values)

Exceptions

exception shyft.dashboard.time_series.axes.YAxisError[source]

Bases: RuntimeError

class shyft.dashboard.time_series.axes.YAxisSide(*values)[source]

Bases: Enum

LEFT = 'left'
RIGHT = 'right'
class shyft.dashboard.time_series.axes.YAxis(*, label, unit, color='black', side=YAxisSide.LEFT, default_y_range=None, dynamic_unit_prefix=False, auto_unit_change=True)[source]

Bases: Hashable, Bindable, AttributeCallbackManager

This object represents the y axis definition

Representation of a y-axis for a figure.

Parameters:
  • label (y axis lable)

  • unit (unit of the axis)

  • color (color of the axis incl. tixs and numbers)

  • side (YAxisSide either YAxisSide.LEFT or YAxisSide.RIGHT)

  • default_y_range (set the default range to use if no renderer on axis)

  • dynamic_unit_prefix (NOT IN USE, used dynamic axis scaling)

  • auto_unit_change (allow that the figure changes the axis units if the axis is empty)

__init__(*, label, unit, color='black', side=YAxisSide.LEFT, default_y_range=None, dynamic_unit_prefix=False, auto_unit_change=True)[source]

Representation of a y-axis for a figure.

Parameters:
  • label (y axis lable)

  • unit (unit of the axis)

  • color (color of the axis incl. tixs and numbers)

  • side (YAxisSide either YAxisSide.LEFT or YAxisSide.RIGHT)

  • default_y_range (set the default range to use if no renderer on axis)

  • dynamic_unit_prefix (NOT IN USE, used dynamic axis scaling)

  • auto_unit_change (allow that the figure changes the axis units if the axis is empty)

Return type:

None

property side: YAxisSide
property default_y_range: Tuple[float, float]
property dynamic_unit_prefix: bool
class shyft.dashboard.time_series.axes.FigureYAxis(*, axis, unit_registry, bokeh_axis=None, y_axis_format=None, logger=None)[source]

Bases: Bindable

This Object represents actual y axis for a Figure class

Figure Y Axis for the figure view container

Parameters:
  • axis (YAxis object which to represent)

  • unit_registry (unit registry to use for unit converison)

  • bokeh_axis (bokeh axis to use)

  • y_axis_format (str | None)

  • logger (logging.Logger | None)

__init__(*, axis, unit_registry, bokeh_axis=None, y_axis_format=None, logger=None)[source]

Figure Y Axis for the figure view container

Parameters:
  • axis (YAxis object which to represent)

  • unit_registry (unit registry to use for unit converison)

  • bokeh_axis (bokeh axis to use)

  • y_axis_format (str | None)

  • logger (Logger | None)

Return type:

None

label_callback(obj, attr, old_value, new_value)[source]

Sets the label for the bokeh Axis

Return type:

None

unit_callback(obj, attr, old_value, new_value)[source]

Sets the color for the bokeh axis

Return type:

None

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

This function sets the color for the bokeh axis

Return type:

None

static axis_format(unit)[source]

This functions sets the y axis number format

Parameters:

unit (str | Unit)

Return type:

str

static unit_view_format(unit)[source]

This function converts the Unit of the y axis

Parameters:

unit (str | Unit)

Return type:

str

property uid: str

This function returns the uid of the axis_view, used to identify this axis

property side: str

This function returns the side of the axis

set_y_range(start, end)[source]

This function sets the axis range to start and end

Parameters:
  • start (float)

  • end (float)

Return type:

None

check_axis_dimensions(attr, old, new)[source]

This function checks if y range has changed enough order of magnitude to trigger unit change

Return type:

None

get_dynamic_axis_unit(start, end)[source]

This function checks if the order of magnitude of the axis should change and returns the changes

Parameters:
  • start (float)

  • end (float)

Return type:

Tuple[float, float, str]

reset_y_range()[source]

This function resets the y range to the default y range defined by YAxis

Return type:

None