Behaviors#
Graph Recording Behaviors#
Behaviors for recording the state of the ipyforcegraph graphs.
- class ipyforcegraph.behaviors.recording.GraphCamera(**kwargs)[source]#
Bases:
BehaviorCaptures the current center and zoom of the graph viewport.
Public constructor
- capturing Bool(False)#
whether visible nodes should be captured as
visible
- center TypedTuple()#
the center of the viewport as [x, y, z?]
- look_at TypedTuple()#
the direction of a 3D camera as [x, y, z?]
- visible TypedTuple()#
the indices of all visible nodes
- zoom Float(None)#
the current 2D zoom level of the viewport
- class ipyforcegraph.behaviors.recording.GraphData(**kwargs)[source]#
Bases:
BehaviorCaptures multiple subsequent ticks of a graph simulation, each as a
DataFrame.Public constructor
- capturing Bool(False)#
whether the dataframe capture is currently active
- source_count Int(1)#
the number of sources to capture
- sources TypedTuple()#
a tuple of
DataFrameSourceto be populated with data of the graph
- class ipyforcegraph.behaviors.recording.GraphDirector(**kwargs)[source]#
Bases:
BehaviorSet a desired center and zoom of the graph viewport.
Public constructor
- center TypedTuple()#
the desired center of the viewport as [x, y, z?]
- fit_duration Float(0.2)#
seconds to animate a fit
- fit_padding Float(10)#
pixels of padding between visible nodes and viewport
- look_at TypedTuple()#
the direction of a 3d camera as [x, y, z]
- pan_duration Float(0.2)#
seconds to animate a pan
- visible Union(None)#
fit nodes in viewport for which this column/template is truthy
- zoom Float(None)#
the desired 2D zoom level of the viewport
- zoom_duration Float(0.2)#
seconds to animate a zoom
- zoom_first Bool(False)#
whether to zoom the viewport before panning
Selection Behaviors#
Selection behaviors for ipyforcegraph nodes and links.
- class ipyforcegraph.behaviors.selection.LinkSelection(**kwargs)[source]#
Bases:
BehaviorEnable link selection with synced ids of selected links.
Public constructor
- column_name Unicode(None)#
an optional name of
node’s column to update when selected
- multiple Bool(True)#
if
False, only onelinkcan be selected at a time
- selected TypedTuple()#
the 0-based indices of any selected links
- selected_color Unicode('rgba(31, 120, 179, 1.0)')#
the color of selected links
- selected_curvature Float(None)#
the curvature of selected links, default:
Nonepreserves unselectedcurvature.
- selected_line_dash TypedTuple(None)#
the line-dash of selected links, default:
Nonepreserves unselectedline_dash
- selected_width Float(2)#
the width of selected links
- class ipyforcegraph.behaviors.selection.NodeSelection(**kwargs)[source]#
Bases:
BehaviorEnable node selection with synced row indices (not
id) of selectednodes.Public constructor
- column_name Unicode(None)#
an optional name of a
node’s column to update when selected
- multiple Bool(True)#
if
False, only onenodecan be selected at a time
- selected TypedTuple()#
the row indices of any selected nodes
- selected_color Unicode('rgba(179, 163, 105, 1.0)')#
the color of selected nodes
Shape Behaviors#
Configurable shapes for ipyforcegraph nodes.
- class ipyforcegraph.behaviors.shapes.Ellipse(**kwargs)[source]#
Bases:
HasDimensionsDraw an ellipse shape.
If the
widthtrait is (or evaluates to)0orNone, no shape will be drawn.Public constructor
- class ipyforcegraph.behaviors.shapes.LinkArrows(**kwargs)[source]#
Bases:
BehaviorCustomize the size, position, and color of arrows on
links.Public constructor
- color Union(None)#
the color of the arrow
- length Union(None)#
the length of the arrow
- relative_position Union(None)#
the relative position of the arrow along the link, 0.0:
sourceend, 1.0:targetend
- class ipyforcegraph.behaviors.shapes.LinkShapes(*shapes, **kwargs)[source]#
Bases:
BehaviorCustomize the shape of the
links.Custom
shapeswill be drawn on top of default lines, and may not interact predictably withcurvature.Note
line_dashis not displayed inForceGraph3D.Public constructor
- color Union(None)#
the color of the link
- curvature Union(None)#
the curvature of the link, 0: straight, 1: circular
- line_dash Union(None)#
the dash line pattern of the link, e.g., [2, 1] for
-- -- --
- shapes TypedTuple()#
the shapes to draw for each
link
- width Union(None)#
the width of the link
- class ipyforcegraph.behaviors.shapes.NodeShapes(*shapes, **kwargs)[source]#
Bases:
BehaviorChange the shape of nodes using declarative statements.
The
colorandsizetraits affect the default circle, and compose withNodeSelection.If non-empty, custom
shapeswill override the simplesizeandcolor, and will require custom handling withcolumn_nameto reflect user selection.Public constructor
- color Union(None)#
the color of the default circle shape
- shapes TypedTuple()#
the shapes to draw for each
node
- size Union(None)#
the size of the default circle shape
- class ipyforcegraph.behaviors.shapes.Rectangle(**kwargs)[source]#
Bases:
HasDimensionsDraw a rectangle shape.
If the
widthtrait is (or evaluates to)0orNone, no shape will be drawn.Public constructor
- class ipyforcegraph.behaviors.shapes.Text(text=None, **kwargs)[source]#
Bases:
HasFillAndStroke,HasOffsetsDraw a text shape, with an optional background.
If the
texttrait is (or evaluates to)0orNone, no shape will be drawn.Public constructor
- background Union(None)#
the background fill color of a shape
- font Union(None)#
the font face of a shape
- padding Union(None)#
the padding around the shape in
px
- size Union(None)#
the visible font size of text in
px
- size_pixels Union(None)#
the rendered size of text in
px. 3D only.
- text Union(None)#
the text of a shape
Particles Behaviors#
Behaviors for controlling particles traveling over ipyforcegraph links.
- class ipyforcegraph.behaviors.particles.LinkParticles(**kwargs)[source]#
Bases:
BehaviorCustomize the animated particles on links.
Note
The
speedshould be between0.0, stationary, and~0.1, or they will exceed the frame rate of the animation.Public constructor
- color Union(None)#
the color of the particles
- density Union(None)#
the number of particles, ideally 0.0 <
value
- speed Union(None)#
the speed of the particles, ideally 0.0 <
value< ~0.1
- width Union(None)#
the size of the particles, ideally 0.0 <
value< ~5
Tooltip Behaviors#
On-hover tooltip behaviors for ipyforcegraph nodes and links.