shyft.dashboard.graph.category_graph

Classes

BaseGraphObject(tag, name, config_key)

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

ExpandCollapseIcons([color_expandable, ...])

GraphConnectionData(edge_objects, ...)

GraphContainerData(node_objects, ...)

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

Bases: object

__init__(tag, name, config_key) None[source]
class shyft.dashboard.graph.category_graph.GraphConnectionData(edge_objects, start_objects, end_objects, edge_layout_keys, revers_dirs)[source]

Bases: NamedTuple

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

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: str = '', color_collapsible: str = '')[source]

Bases: Widget

__init__(color_expandable: str = '', color_collapsible: str = '') None[source]

Base class for all Widgets

Parameters:

logger – Optional logger, e.g composable_logger_box

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: ndarray, x_origin: ndarray, y_origin: ndarray, size: ndarray, visibility: List[bool]) None[source]
update_data_source() None[source]
clear() None[source]
expand_collapse(attr, old, new)[source]
class shyft.dashboard.graph.category_graph.CategoryGraph(*, height: int, width: int = None, aspect_factor: float = 4.5, text_font: str = 'monospace', text_font_style: str = 'bold')[source]

Bases: Widget

__init__(*, height: int, width: int = None, aspect_factor: float = 4.5, text_font: str = 'monospace', text_font_style: str = 'bold') None[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 – figure height

  • width – figure width

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

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

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

property layout: LayoutDOM
generate_graph(container: List[GraphContainerData], connections: List[GraphConnectionData], collapse_children: List[str] = None, pydot_config: Dict = None, bokeh_config: Dict = None) None[source]

Main function to generate a category graph

Parameters:
  • container – all graph objects with config keys

  • connections – all graph connection objects with config keys

  • collapse_children – name of all graph objects which are collapsable

  • pydot_config – Optional dict with graph configuration to adapt layout

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

property tag_children_visibility: Dict[int, bool]

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

draw_graph() None[source]

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

clear_figure() None[source]

clear the figure

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

Returns layout components