shyft.dashboard.time_series.tools.figure_tools
Classes
|
|
|
|
|
Tool to download all data shown in all figures where this tool is attached to! |
|
This object represents the base class of all figure tools |
|
Tool to display the label, x, and y values of a glyph contained in a figure |
|
Tool to toggle the information shown by tooltips. |
|
|
|
Tool to reset the y-range of a figure to the default view |
|
Hover tool to display the label of a time series. |
|
Range slider used to select an interval along the time-axis in a given figure |
|
Tool to select a specific time period visually in the view container |
|
Tool to reset the y-range of a figure to the default view |
|
Tool to change the direction of zooming when scrolling the mouse wheel between x and y direction |
Exceptions
- exception shyft.dashboard.time_series.tools.figure_tools.FigureToolError[source]
Bases:
RuntimeError
- class shyft.dashboard.time_series.tools.figure_tools.FigureTool(logger=None)[source]
Bases:
BaseTool
This object represents the base class of all figure tools
- class shyft.dashboard.time_series.tools.figure_tools.ResetYRange(width: int = 120, height: int = 30, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
Bases:
FigureTool
Tool to reset the y-range of a figure to the default view
- __init__(width: int = 120, height: int = 30, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
- Parameters:
logger – optional logger
- property layout_components: Dict[str, List[Any]]
- class shyft.dashboard.time_series.tools.figure_tools.ActiveScroll(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
- X_axis = 1
- Y_axis = 2
- class shyft.dashboard.time_series.tools.figure_tools.WheelZoomDirection(height: int = 30, width: int = 140, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
Bases:
FigureTool
,Widget
Tool to change the direction of zooming when scrolling the mouse wheel between x and y direction
- __init__(height: int = 30, width: int = 140, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
- Parameters:
logger – optional logger
- property layout: LayoutDOM
- property layout_components: Dict[str, List[Any]]
Property to return all layout.dom components of an visualisation app such that they can be arranged by the parent layout obj as desired.
- Returns:
layout_components as
- Return type:
{‘widgets’: [], ‘figures’: []}
- set_active_scroll(active_scroll: ActiveScroll)[source]
- class shyft.dashboard.time_series.tools.figure_tools.ExportLineDataButton(label: str = 'Download Figure Data', height: int = 50, width: int = 150, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
Bases:
FigureTool
,Widget
Tool to download all data shown in all figures where this tool is attached to!
Two obstacles: - each obj/renderer in a figure has its own data source with own amount of time, value tuples - js callbacks and python callbacks in bokeh are not sync
Therefore: - for each renderer one separate csv file is downloaded - we create a bokeh PreText obj in addition to the download button, to which we attach a js callback for the download after the download the callback is removed again
- __init__(label: str = 'Download Figure Data', height: int = 50, width: int = 150, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
- Parameters:
logger – optional logger
- static js_callback(*, sources: List[ColumnDataSource], names: List[str]) str [source]
Creates js to download all data from multiple data sources to multiple csv files
- property layout_components: Dict[str, List[Any]]
Property to return all layout.dom components of an visualisation app such that they can be arranged by the parent layout obj as desired.
- Returns:
layout_components as
- Return type:
{‘widgets’: [], ‘figures’: []}
- property layout: LayoutDOM
- class shyft.dashboard.time_series.tools.figure_tools.HoverToolToggleDropdown(hover_tools: List[HoverTool])[source]
Bases:
object
Tool to toggle the information shown by tooltips. The three modes are: - info and data - data - no tooltip Info and data should be provided as the default tooltip-mode in the supplied hover tools.
- class shyft.dashboard.time_series.tools.figure_tools.HoverTool(*, point_policy: str = 'snap_to_data', tooltips: List[Tuple[str, str]] = None, formatters: Dict[str, str] = None, show_arrow: bool = False, mode: str = 'mouse', logger=None)[source]
Bases:
FigureTool
Tool to display the label, x, and y values of a glyph contained in a figure
- __init__(*, point_policy: str = 'snap_to_data', tooltips: List[Tuple[str, str]] = None, formatters: Dict[str, str] = None, show_arrow: bool = False, mode: str = 'mouse', logger=None)[source]
- Parameters:
point_policy – ‘snap_to_data’ or ‘follow_mouse’
tooltips – a list of tooltips where each row contains a label, and its associated value
formatters – how the tooltips will be formatted: available formatters: “printf”, “datetime”, and “numeral”
show_arrow – to show the arrow
mode – if ‘mouse’, then only when the mouse is directly over the glyph, if ‘vline’ and ‘hline’: whenever the vertical or horizontal line from the mouse position intersects the glyph
logger – the logger
- register_view_renderer(view: FigureView, renderer: BaseFigureRenderer)[source]
- remove_renderer(renderer: BaseFigureRenderer) None [source]
- class shyft.dashboard.time_series.tools.figure_tools.TimePeriodSelectorInFigure(time_zone='Europe/Oslo', logger=None)[source]
Bases:
FigureTool
,Widget
Tool to select a specific time period visually in the view container
- __init__(time_zone='Europe/Oslo', logger=None)[source]
All x parameters are in the shyft native coordinates, i.e in epoch time seconds
- Parameters:
time_zone – time zone to use for period calculations
logger – optional logger
- property layout: LayoutDOM
- property layout_components: Dict[str, List[Any]]
Property to return all layout.dom components of an visualisation app such that they can be arranged by the parent layout obj as desired.
- Returns:
layout_components as
- Return type:
{‘widgets’: [], ‘figures’: []}
- class shyft.dashboard.time_series.tools.figure_tools.ShowTsLabel(label: str = 'show label', height: int = 30, width: int = 140, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
Bases:
FigureTool
,Widget
Hover tool to display the label of a time series.
- __init__(label: str = 'show label', height: int = 30, width: int = 140, padding: int | None = None, sizing_mode: str | None = None, logger=None)[source]
- Parameters:
label (the label) –
height (the height) –
width (the width) –
padding (optional padding) –
sizing_mode (optional sizing mode) –
logger (optional logger) –
- property layout: LayoutDOM
- property layout_components: Dict[str, List[Any]]
Property to return all layout.dom components of an visualisation app such that they can be arranged by the parent layout obj as desired.
- Returns:
layout_components as
- Return type:
{‘widgets’: [], ‘figures’: []}
- class shyft.dashboard.time_series.tools.figure_tools.Actions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
- freeze = 0
- move = 1
- extend_right = 2
- extend_left = 3
- class shyft.dashboard.time_series.tools.figure_tools.Modes[source]
Bases:
object
- fixed_dt = 'Fixed dt'
- snap_to_dt = 'Snap to dt'
- free_range = 'Free range'
- class shyft.dashboard.time_series.tools.figure_tools.TimePeriodSelectorSlider(slider_width: int, width: int = 120, height: int = 120, time_zone='Europe/Oslo', color: str = '#b3de69', title='Select time period selector', padding: int | None = None, sizing_mode: str | None = None, layout_margin: Tuple[int, int, int, int] = None, logger=None)[source]
Bases:
FigureTool
,Widget
Tool to reset the y-range of a figure to the default view
- __init__(slider_width: int, width: int = 120, height: int = 120, time_zone='Europe/Oslo', color: str = '#b3de69', title='Select time period selector', padding: int | None = None, sizing_mode: str | None = None, layout_margin: Tuple[int, int, int, int] = None, logger=None)[source]
- Parameters:
logger – optional logger
- property layout_components: Dict[str, List[Any]]
Property to return all layout.dom components of an visualisation app such that they can be arranged by the parent layout obj as desired.
- Returns:
layout_components as
- Return type:
{‘widgets’: [], ‘figures’: []}
- property layout
- class shyft.dashboard.time_series.tools.figure_tools.TimeIntervalSelectorSlider(width: int, title: str = 'Time period', time_zone: str = 'Europe/Oslo', color: str = '#b3de69', sizing_mode: str | None = None, show_value: bool = False, tooltips: bool = False, layout_margin: Tuple[int, int, int, int] = None, logger=None)[source]
Bases:
FigureTool
,Widget
Range slider used to select an interval along the time-axis in a given figure
- __init__(width: int, title: str = 'Time period', time_zone: str = 'Europe/Oslo', color: str = '#b3de69', sizing_mode: str | None = None, show_value: bool = False, tooltips: bool = False, layout_margin: Tuple[int, int, int, int] = None, logger=None)[source]
- Parameters:
width (width of the slider) –
title (slider title) –
time_zone (time zone to use for period calculations, default: 'Europe/Oslo') –
color (color of the box (selected area)) –
sizing_mode (the mode used for the items of slider to resize to fill the available space) –
show_value (show the the value of slider along the title) –
tooltips (slider tooltips) –
layout_margin (margin) –
logger (optional logger) –
- property layout_components: Dict[str, List[Any]]
Property to return all layout.dom components of an visualisation app such that they can be arranged by the parent layout obj as desired.
- Returns:
layout_components as
- Return type:
{‘widgets’: [], ‘figures’: []}
- property layout