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:
BaseToolThis object represents the base class of all figure tools
- Parameters:
logger – optional logger
- class shyft.dashboard.time_series.tools.figure_tools.ResetYRange(width=120, height=30, padding=None, sizing_mode=None, logger=None)[source]¶
Bases:
FigureToolTool to reset the y-range of a figure to the default view
- Parameters:
logger – optional logger
width (int)
height (int)
padding (int | None)
sizing_mode (str | None)
- __init__(width=120, height=30, padding=None, sizing_mode=None, logger=None)[source]¶
- Parameters:
logger – optional logger
width (int)
height (int)
padding (int | None)
sizing_mode (str | None)
- on_bind(*, parent)[source]¶
Abstract method which is call on bind to a parent
- Parameters:
parent (Any)
- Return type:
None
- property layout_components: Dict[str, List[Any]]¶
- class shyft.dashboard.time_series.tools.figure_tools.ActiveScroll(*values)[source]¶
Bases:
Enum- X_axis = 1¶
- Y_axis = 2¶
- class shyft.dashboard.time_series.tools.figure_tools.WheelZoomDirection(height=30, width=140, padding=None, sizing_mode=None, logger=None)[source]¶
Bases:
FigureTool,WidgetTool to change the direction of zooming when scrolling the mouse wheel between x and y direction
- Parameters:
logger – optional logger
height (int)
width (int)
padding (int | None)
sizing_mode (str | None)
- __init__(height=30, width=140, padding=None, sizing_mode=None, logger=None)[source]¶
- Parameters:
logger – optional logger
height (int)
width (int)
padding (int | None)
sizing_mode (str | None)
- 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’: []}
- on_bind(*, parent)[source]¶
Abstract method which is call on bind to a parent
- Parameters:
parent (Any)
- set_active_scroll(active_scroll)[source]¶
- Parameters:
active_scroll (ActiveScroll)
- class shyft.dashboard.time_series.tools.figure_tools.ExportLineDataButton(label='Download Figure Data', height=50, width=150, padding=None, sizing_mode=None, logger=None)[source]¶
Bases:
FigureTool,WidgetTool 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
- Parameters:
logger – optional logger
label (str)
height (int)
width (int)
padding (int | None)
sizing_mode (str | None)
- __init__(label='Download Figure Data', height=50, width=150, padding=None, sizing_mode=None, logger=None)[source]¶
- Parameters:
logger – optional logger
label (str)
height (int)
width (int)
padding (int | None)
sizing_mode (str | None)
- on_bind(*, parent)[source]¶
Abstract method which is call on bind to a parent
- Parameters:
parent (Any)
- Return type:
None
- static js_callback(*, sources, names)[source]¶
Creates js to download all data from multiple data sources to multiple csv files
- Parameters:
sources (List[ColumnDataSource])
names (List[str])
- Return type:
str
- 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)[source]¶
Bases:
objectTool 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.
- Parameters:
hover_tools (List[HoverTool]) – hover tools which are to interact with toggle dropdown.
- class shyft.dashboard.time_series.tools.figure_tools.HoverTool(*, point_policy='snap_to_data', tooltips=None, formatters=None, show_arrow=False, mode='mouse', logger=None)[source]¶
Bases:
FigureToolTool to display the label, x, and y values of a glyph contained in a figure
- Parameters:
point_policy (str) – ‘snap_to_data’ or ‘follow_mouse’
tooltips (List[Tuple[str, str]]) – a list of tooltips where each row contains a label, and its associated value
formatters (Dict[str, str]) – how the tooltips will be formatted: available formatters: “printf”, “datetime”, and “numeral”
show_arrow (bool) – to show the arrow
mode (str) – 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
- __init__(*, point_policy='snap_to_data', tooltips=None, formatters=None, show_arrow=False, mode='mouse', logger=None)[source]¶
- Parameters:
point_policy (str) – ‘snap_to_data’ or ‘follow_mouse’
tooltips (List[Tuple[str, str]]) – a list of tooltips where each row contains a label, and its associated value
formatters (Dict[str, str]) – how the tooltips will be formatted: available formatters: “printf”, “datetime”, and “numeral”
show_arrow (bool) – to show the arrow
mode (str) – 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
- on_bind(*, parent)[source]¶
Abstract method which is call on bind to a parent
- Parameters:
parent (Any)
- register_view_renderer(view, renderer)[source]¶
- Parameters:
view (FigureView)
renderer (BaseFigureRenderer)
- remove_renderer(renderer)[source]¶
- Parameters:
renderer (BaseFigureRenderer)
- Return type:
None
- class shyft.dashboard.time_series.tools.figure_tools.TimePeriodSelectorInFigure(time_zone='Europe/Oslo', logger=None)[source]¶
Bases:
FigureTool,WidgetTool to select a specific time period visually in the view container
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
- __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’: []}
- on_bind(*, parent)[source]¶
Abstract method which is call on bind to a parent
- Parameters:
parent (Any)
- Return type:
None
- class shyft.dashboard.time_series.tools.figure_tools.ShowTsLabel(label='show label', height=30, width=140, padding=None, sizing_mode=None, logger=None)[source]¶
Bases:
FigureTool,WidgetHover tool to display the label of a time series.
- Parameters:
label (the label)
height (the height)
width (the width)
padding (optional padding)
sizing_mode (optional sizing mode)
logger (optional logger)
- __init__(label='show label', height=30, width=140, padding=None, sizing_mode=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(*values)[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, width=120, height=120, time_zone='Europe/Oslo', color='#b3de69', title='Select time period selector', padding=None, sizing_mode=None, layout_margin=None, logger=None)[source]¶
Bases:
FigureTool,WidgetTool to reset the y-range of a figure to the default view
- Parameters:
logger – optional logger
slider_width (int)
width (int)
height (int)
color (str)
padding (int | None)
sizing_mode (str | None)
layout_margin (Tuple[int, int, int, int])
- __init__(slider_width, width=120, height=120, time_zone='Europe/Oslo', color='#b3de69', title='Select time period selector', padding=None, sizing_mode=None, layout_margin=None, logger=None)[source]¶
- Parameters:
logger – optional logger
slider_width (int)
width (int)
height (int)
color (str)
padding (int | None)
sizing_mode (str | None)
layout_margin (Tuple[int, int, int, int])
- on_bind(*, parent)[source]¶
Abstract method which is call on bind to a parent
- Parameters:
parent (Any)
- Return type:
None
- 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, title='Time period', time_zone='Europe/Oslo', color='#b3de69', sizing_mode=None, show_value=False, tooltips=False, layout_margin=None, logger=None)[source]¶
Bases:
FigureTool,WidgetRange slider used to select an interval along the time-axis in a given figure
- 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)
- __init__(width, title='Time period', time_zone='Europe/Oslo', color='#b3de69', sizing_mode=None, show_value=False, tooltips=False, layout_margin=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¶