Module

DataViz.Layout.StateMachine.Layout

Package
purescript-hylograph-layout
Repository
afcondon/purescript-hylograph-layout

DataViz.Layout.StateMachine.Layout

Pure layout algorithms for state machine visualization. Arranges states in a circular layout and computes curved arrow paths for transitions.

#layout Source

layout :: forall se te. StateMachine se te -> StateMachineLayout se te

Layout a state machine with default configuration using circular layout

#layoutWithConfig Source

layoutWithConfig :: forall se te. LayoutConfig -> (LayoutConfig -> Array (State se) -> Array (LayoutState se)) -> StateMachine se te -> StateMachineLayout se te

Layout with custom configuration and layout strategy

#LayoutConfig Source

type LayoutConfig = { arrowOffset :: Number, edgeCurvature :: Number, initialArrowLength :: Number, labelOffset :: Number, layoutRadius :: Number, margin :: Number, minPairedCurvature :: Number, parallelSeparation :: Number, selfLoopRadius :: Number, stateRadiusX :: Number, stateRadiusY :: Number }

Configuration for state machine layout

#defaultConfig Source

defaultConfig :: LayoutConfig

Default layout configuration

#circularLayout Source

circularLayout :: forall extra. LayoutConfig -> Array (State extra) -> Array (LayoutState extra)

Circular layout: arrange states in a circle

#gridLayout Source

gridLayout :: forall extra. LayoutConfig -> Array (State extra) -> Array (LayoutState extra)

Grid layout: arrange states in rows

#ParallelInfo Source

type ParallelInfo = { count :: Int, hasOpposite :: Boolean, index :: Int }

Where a transition sits among those sharing its endpoints.

index/count place same-direction siblings side by side. hasOpposite is the antiparallel case and needs different treatment: A->B and B->A already bow to opposite sides of the line (the perpendicular is computed from the travel direction, which is reversed), so they want the same positive magnitude rather than opposite offsets — they just need that magnitude floored so the gap survives a flat base curve.