shyft.dashboard.graph.category_graph

Classes

BaseGraphObject(tag, name, config_key)

CategoryGraph(*, height[, width, ...])

Draws a categorical graph of items in a Bokeh plot.

ExpandCollapseIcons([color_expandable, ...])

Base class for all Widgets

GraphConnectionData(edge_objects, ...)

Create new instance of GraphConnectionData(edge_objects, start_objects, end_objects, edge_layout_keys, revers_dirs)

GraphContainerData(node_objects, ...)

Create new instance of GraphContainerData(node_objects, object_layout_keys)

class shyft.dashboard.graph.category_graph.BaseGraphObject(tag, name, config_key)[source]

Bases: object

__init__(tag, name, config_key)[source]
Return type:

None

class shyft.dashboard.graph.category_graph.GraphConnectionData(edge_objects, start_objects, end_objects, edge_layout_keys, revers_dirs)[source]

Bases: NamedTuple

Create new instance of GraphConnectionData(edge_objects, start_objects, end_objects, edge_layout_keys, revers_dirs)

Parameters:
edge_objects: List[BaseGraphObject]

Alias for field number 0

start_objects: List[BaseGraphObject]

Alias for field number 1

end_objects: List[BaseGraphObject]

Alias for field number 2

edge_layout_keys: List[str]

Alias for field number 3

revers_dirs: List[bool]

Alias for field number 4

class shyft.dashboard.graph.category_graph.GraphContainerData(node_objects, object_layout_keys)[source]

Bases: NamedTuple

Create new instance of GraphContainerData(node_objects, object_layout_keys)

Parameters:
node_objects: List[BaseGraphObject]

Alias for field number 0

object_layout_keys: List[str]

Alias for field number 1

class shyft.dashboard.graph.category_graph.ExpandCollapseIcons(color_expandable='', color_collapsible='')[source]

Bases: Widget

Base class for all Widgets

Parameters:
  • logger – Optional logger, e.g composable_logger_box

  • color_expandable (str)

  • color_collapsible (str)

__init__(color_expandable='', color_collapsible='')[source]

Base class for all Widgets

Parameters:
  • logger – Optional logger, e.g composable_logger_box

  • color_expandable (str)

  • color_collapsible (str)

Return type:

None

property layout: LayoutDOM | None
property glyphs: Tuple[ColumnDataSource, Model]
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’: []}

add_icons(tags, x_origin, y_origin, size, visibility)[source]
Parameters:
  • tags (ndarray)

  • x_origin (ndarray)

  • y_origin (ndarray)

  • size (ndarray)

  • visibility (List[bool])

Return type:

None

update_data_source()[source]
Return type:

None

clear()[source]
Return type:

None

expand_collapse(attr, old, new)[source]
class shyft.dashboard.graph.category_graph.CategoryGraph(*, height, width=None, aspect_factor=4.5, text_font='monospace', text_font_style='bold')[source]

Bases: Widget

Draws a categorical graph of items in a Bokeh plot. The graph layout is created with graphiz and pydot, based on the shyft.util.layput_graph pkg.

The graph objects and graph connections are added with the function generate_graph.

Parameters:
  • height (int) – figure height

  • width (int) – figure width

  • aspect_factor (float) – aspect factor between with and height, can be added instead of width default 4.5

  • text_font (str) – the text font (options: ‘monospace’,’verdana’, ‘times’, ‘helvetica’, etc.)

  • text_font_style (str) – style of the font (options: ‘normal’, ‘italic’ or ‘bold’)

__init__(*, height, width=None, aspect_factor=4.5, text_font='monospace', text_font_style='bold')[source]

Draws a categorical graph of items in a Bokeh plot. The graph layout is created with graphiz and pydot, based on the shyft.util.layput_graph pkg.

The graph objects and graph connections are added with the function generate_graph.

Parameters:
  • height (int) – figure height

  • width (int) – figure width

  • aspect_factor (float) – aspect factor between with and height, can be added instead of width default 4.5

  • text_font (str) – the text font (options: ‘monospace’,’verdana’, ‘times’, ‘helvetica’, etc.)

  • text_font_style (str) – style of the font (options: ‘normal’, ‘italic’ or ‘bold’)

Return type:

None

property layout: LayoutDOM
generate_graph(container, connections, collapse_children=None, pydot_config=None, bokeh_config=None)[source]

Main function to generate a category graph

Parameters:
  • container (List[GraphContainerData]) – all graph objects with config keys

  • connections (List[GraphConnectionData]) – all graph connection objects with config keys

  • collapse_children (List[str]) – name of all graph objects which are collapsable

  • pydot_config (Dict) – Optional dict with graph configuration to adapt layout

  • bokeh_config (Dict) – Optional dict with visual configuration of categories or elements

Return type:

None

property tag_children_visibility: Dict[int, bool]

Figure out which graph elements have visible children, i.e are not collapsed

draw_graph()[source]

This function draws the graph, i.e, updates all patches and the figure

Return type:

None

clear_figure()[source]

clear the figure

Return type:

None

property layout_components: Dict[str, List[Any]]

Returns layout components