shyft.dashboard.maps.map_layer¶
Functions
|
This function evaluates tooltips for bokeh.Hover for required fields in data source |
Classes
|
Layer of Map Viewer |
|
Enum defining expected keys to create a bokeh glyph |
Exceptions
- class shyft.dashboard.maps.map_layer.MapLayerType(*values)[source]¶
Bases:
EnumEnum defining expected keys to create a bokeh glyph
Note
First variable should be x coordinates
Second variable should be y coordinates
- POINT = ('x', 'y')¶
- POLYGON = ('xs', 'ys')¶
- LABEL = ('x', 'y', 'text')¶
- shyft.dashboard.maps.map_layer.find_tags_from_tooltips(tool_tips)[source]¶
This function evaluates tooltips for bokeh.Hover for required fields in data source
- Parameters:
tool_tips (List[Tuple[str, str]]) – List of Tuples with 2 strings as defiend in bokeh
- Return type:
Set[str]
Examples
tt = [(“Type”, “@type”),(“Name”, “@name”)]find_tags_from_tooltips(tt)>>> {‘type’, ‘name’}- Return type:
a set of required field names
- Parameters:
tool_tips (List[Tuple[str, str]])
- class shyft.dashboard.maps.map_layer.MapLayer(*, map_viewer, name, layer_type, glyph_variable_kwargs, glyph_fixed_kwargs, visible=True, selectable=False, update_axes=True, hover_tool_tips=None)[source]¶
-
Layer of Map Viewer
Each layer adds a bokeh glyph to the map. The draw order is controlled by the order the layers are created. The type of bokeh glyphs are controlled by the LayerType:
LayerType.POINT => Circles
nLayerType.POLYGON => Patches
Labels are only supported for LayerType.POINT
- Parameters:
map_viewer (statkraft.bokeh.maps.map_viewer.MapViewer) – MapViewer instance to add this layer to
name (str) – name of the layer
layer_type (MapLayerType) – type of the layer
glyph_variable_kwargs (Dict[str, str | float | int]) – glyph variable kwargs which are controlled in the data source e.g. {‘xs’: ‘x_values’}
glyph_fixed_kwargs (Dict[str, str | float | int]) – glyph fixed kwargs which are set only by initialisation e.g {‘color’: ‘red’}
visible (bool) – visibility of the layer at initialisation
selectable (bool) – if glyphs can be selected with the selection tool
update_axes (bool) – if the bbox of this layer should be used in MapViewer.figure_axis
hover_tool_tips (List[Tuple[str, str]] | None) – hover over information
- __init__(*, map_viewer, name, layer_type, glyph_variable_kwargs, glyph_fixed_kwargs, visible=True, selectable=False, update_axes=True, hover_tool_tips=None)[source]¶
Layer of Map Viewer
Each layer adds a bokeh glyph to the map. The draw order is controlled by the order the layers are created. The type of bokeh glyphs are controlled by the LayerType:
LayerType.POINT => Circles
nLayerType.POLYGON => Patches
Labels are only supported for LayerType.POINT
- Parameters:
map_viewer (statkraft.bokeh.maps.map_viewer.MapViewer) – MapViewer instance to add this layer to
name (str) – name of the layer
layer_type (MapLayerType) – type of the layer
glyph_variable_kwargs (Dict[str, str | float | int]) – glyph variable kwargs which are controlled in the data source e.g. {‘xs’: ‘x_values’}
glyph_fixed_kwargs (Dict[str, str | float | int]) – glyph fixed kwargs which are set only by initialisation e.g {‘color’: ‘red’}
visible (bool) – visibility of the layer at initialisation
selectable (bool) – if glyphs can be selected with the selection tool
update_axes (bool) – if the bbox of this layer should be used in MapViewer.figure_axis
hover_tool_tips (List[Tuple[str, str]] | None) – hover over information
- Return type:
None
- on_bind(*, parent)[source]¶
Function which is call when bound to a figure
- Parameters:
parent (statkraft.bokeh.maps.map_viewer.MapViewer)
- Return type:
None
- property bbox: Tuple[float, float, float, float] | None¶
returns bounding box of defined geometry i.e x_min, y_min, x_max, y_max if data is defined
- check_data_compatibility(new_data)[source]¶
This function checks if new data is compatible with layer :raises LayerError when incompatible:
- Parameters:
new_data (Dict[str, List[str] | List[int] | List[float]])
- Return type:
None
- updated_data(new_data)[source]¶
This function is updates the layer data if proper defined
- Parameters:
new_data (Dict[str, List[str] | List[int] | List[float]])
- Return type:
None
- property visible: bool¶
Visibility of the glyph