Skip to main content

Crate gpui_graph

Crate gpui_graph 

Source
Expand description

Force-directed network graph component for GPUI, built on gpui-base.

NetworkGraph is a stateful view (an Entity): it owns the layout, viewport, hover and selection state across frames. Create it with cx.new, feed it GraphData and subscribe to NetworkGraphEvents. The host app owns data loading, panels and menus; it answers events such as NetworkGraphEvent::ContextMenu with its own UI.

Call init once at startup to register the keyboard bindings (arrow keys move the selection, Enter activates, Escape clears, =/-/0 zoom and fit, Shift-F10 opens the context menu). The graph is a tab stop.

Colors follow the gpui-base Theme unless overridden with NetworkGraph::with_colors.

Re-exports§

pub use actions::init;

Modules§

actions

Structs§

CategoryInfo
A category present in the graph, for legends.
Edge
A directed relationship between two nodes. Parallel edges and self-loops are allowed.
ForceConfig
Tuning knobs, named after their d3-force counterparts.
GraphColors
Colors the graph paints with. By default they are derived from the gpui-base Theme every frame, so appearance changes apply immediately.
GraphData
A batch of nodes and edges, as returned by a query.
GroupInfo
A group (community) present in the graph.
NetworkGraph
An interactive, force-directed network graph.
Node
A vertex in the graph. Build with Node::new and the builder methods.
Palette
Category / group colors, assigned in the order they first appear.

Enums§

ColorBy
What node colors encode.
LabelMode
Which node labels are drawn.
NetworkGraphEvent
NodeSizing
How node radius (in world units) is derived when a node has no explicit size.
Selection
What the user has selected or is pointing at.

Type Aliases§

TooltipBuilder
Builds tooltip content for the hovered item; None hides the tooltip.