Widgets#
Diagram Widget#
- class ipyelk.Diagram(**kwargs: Any)#
An Elk diagramming widget to help coordinate the
Viewer
andPipe
Attributes#
- source:
MarkElementWidget
input source to the diagram’s processing pipe
- pipe:
Pipe
processing pipe (that may contain sub-pipes). Pipes perform various tasks like adding x/y and width/height layouts or calculating text label sizes.
- view:
Viewer
output view that will render the pipe outlet
- tools: tuple
Tool
list of tools that a user of the diagram might use to manipulate the state of the diagram.
- symbols:
SymbolSpec
additional shape definitions that can be used in rendering the diagram. For example unique arrow head shapes or custom node shapes.
- get_tool(tool_type)#
Get the tool that matches the given Tool type.
- refresh(change=None)#
Create asynchronous refresh task which will update the view given any changes.
- Return type:
Task
- register_tool(tool)#
Add a new tool to the diagram.
- source: MarkElementWidget#
Syncs Elk JSON Elements
- source:
Viewer Widget#
- class ipyelk.diagram.Viewer(**kwargs: Any)#
Generic Viewer of ELK Json diagrams. Currently only mainly used by
SprottyViewer
Attributes#
- source:
MarkElementWidget
input source for rendering.
- selection:
Selection
maintains selected ids and methods to resolve the python elements.
- hover:
Hover
maintains hovered ids.
zoom:
Zoom
pan:
Pan
- control_overlay:
ControlOverlay
additional jupyterlab widgets that can be rendered ontop of the diagram based on the current selected states.
- source:
- class ipyelk.diagram.SprottyViewer(**kwargs: Any)#
Jupyterlab widget for displaying and interacting with views generated from ELK JSON.
Setting the instance’s value traitlet to valid Eclipse Layout Kernal JSON will call the elkjs layout method and display the returned mark_layout using sprotty.
- center(model_ids=None, animate=None, retain_zoom=None)#
Center Diagram View on specified model ids
- Parameters:
model_ids (
List
[str
]) – list of elk model id strings, defaults to Noneanimate (
bool
) – specify is the view animates to the given marksretain_zoom (
bool
) – specify if the current zoom level is maintained
- fit(model_ids=None, animate=None, max_zoom=None, padding=None)#
Pan/Zoom the Diagram View to focus on particular model ids
- Parameters:
model_ids (
List
[str
]) – list of elk model id strings, defaults to Noneanimate (
bool
) – specify is the view animates to the given marksmax_zoom (
float
) – specify if the max zoom levelpadding (
float
) – specify if the viewport padding around the marks