Module

Hylograph.Expr.Path

Package
purescript-hylograph-selection
Repository
afcondon/purescript-hylograph-selection

Path DSL

Pre-canned path generators for common visualization patterns. These cover 90%+ of data visualization path needs:

  • Links (trees, Sankey, network graphs)
  • Ribbons (chord diagrams)
  • Arcs (pie/donut charts)
  • Simple shapes (lines, areas)

More expressive than Mermaid/Vegalite, but without requiring arbitrary imperative path string building.

#PathExpr Source

class PathExpr :: (Type -> Type) -> Constraintclass PathExpr repr  where

Path expressions - generate SVG path strings

Each interpreter handles these differently:

  • Eval: computes the actual path string
  • CodeGen: generates (linkHorizontal x1 y1 x2 y2)
  • SVG: computes the path string (same as Eval for paths)

Members

  • linePath :: repr Number -> repr Number -> repr Number -> repr Number -> repr String

    Straight line from (x1,y1) to (x2,y2) Generates: "M x1,y1 L x2,y2"

  • polylinePath :: repr (Array { x :: Number, y :: Number }) -> repr String

    Polyline through multiple points Takes array of {x, y} points Generates: "M x0,y0 L x1,y1 L x2,y2 ..."

  • linkHorizontal :: repr Number -> repr Number -> repr Number -> repr Number -> repr String

    Horizontal link with cubic bezier (left-to-right trees) Control points at horizontal midpoint

     source ----╮
                ╰---- target
    

    Generates: "M x1,y1 C mx,y1 mx,y2 x2,y2" where mx = (x1+x2)/2

  • linkVertical :: repr Number -> repr Number -> repr Number -> repr Number -> repr String

    Vertical link with cubic bezier (top-down trees) Control points at vertical midpoint

        source
           |
           ╰---╮
               target
    

    Generates: "M x1,y1 C x1,my x2,my x2,y2" where my = (y1+y2)/2

  • linkRadial :: repr Number -> repr Number -> repr Number -> repr Number -> repr String

    Radial link for radial/circular tree layouts Takes angles (radians) and radii instead of x,y

    Generates curved path from (angle1, radius1) to (angle2, radius2)

  • ribbon :: repr Number -> repr Number -> repr Number -> repr Number -> repr Number -> repr Number -> repr String

    Ribbon for chord diagrams Connects two arcs on a circle with curved bands

    Takes: source arc (startAngle, endAngle), target arc (startAngle, endAngle), radius

    The ribbon is a closed shape suitable for fill

  • arc :: repr Number -> repr Number -> repr Number -> repr Number -> repr String

    Arc segment (for pie/donut charts, chord diagram outer ring)

    Generates arc from startAngle to endAngle at given radii Closed shape suitable for fill

  • closePath :: repr String -> repr String

    Append "Z" to close a path

Modules
Data.DependencyGraph
Hylograph.AST
Hylograph.Axis.Axis
Hylograph.Brush
Hylograph.Brush.FFI
Hylograph.Brush.Types
Hylograph.Classify
Hylograph.Data.Graph
Hylograph.Data.Graph.Algorithms
Hylograph.Data.Node
Hylograph.Data.Tree
Hylograph.Expr.Animation
Hylograph.Expr.Attr
Hylograph.Expr.Datum
Hylograph.Expr.Expr
Hylograph.Expr.Friendly
Hylograph.Expr.Integration
Hylograph.Expr.Interpreter.CodeGen
Hylograph.Expr.Interpreter.Eval
Hylograph.Expr.Interpreter.Meta
Hylograph.Expr.Interpreter.PureSVG
Hylograph.Expr.Interpreter.SVG
Hylograph.Expr.Path
Hylograph.Expr.Path.Generators
Hylograph.Expr.Sugar
Hylograph.Expr.Units
Hylograph.HATS
Hylograph.HATS.Friendly
Hylograph.HATS.InterpreterTick
Hylograph.HATS.Transitions
Hylograph.Interaction.Brush
Hylograph.Interaction.Coordinated
Hylograph.Interaction.Pointer
Hylograph.Interaction.Zoom
Hylograph.Internal.Attribute
Hylograph.Internal.Behavior.FFI
Hylograph.Internal.Behavior.Types
Hylograph.Internal.Capabilities.Selection
Hylograph.Internal.Capabilities.Transition
Hylograph.Internal.FFI
Hylograph.Internal.Selection.Join
Hylograph.Internal.Selection.Operations
Hylograph.Internal.Selection.Operations.Conversions
Hylograph.Internal.Selection.Operations.Helpers
Hylograph.Internal.Selection.Operations.Selection
Hylograph.Internal.Selection.Query
Hylograph.Internal.Selection.Types
Hylograph.Internal.Transition.FFI
Hylograph.Internal.Transition.Manager
Hylograph.Internal.Transition.Scene
Hylograph.Internal.Transition.Types
Hylograph.Internal.Types
Hylograph.Interpreter.D3
Hylograph.Interpreter.English
Hylograph.Interpreter.Mermaid
Hylograph.Interpreter.MetaAST
Hylograph.Interpreter.SemiQuine
Hylograph.Interpreter.SemiQuine.TreeToCode
Hylograph.Interpreter.SemiQuine.Types
Hylograph.Render
Hylograph.Scale
Hylograph.Scale.FP
Hylograph.Shape.Arc
Hylograph.Shape.Pie
Hylograph.Shape.Polygon
Hylograph.Tooltip
Hylograph.Transform
Hylograph.TreeDSL
Hylograph.TreeDSL.ShapeTree
Hylograph.Unified
Hylograph.Unified.Attribute
Hylograph.Unified.DataDSL
Hylograph.Unified.Display
Hylograph.Unified.Examples
Hylograph.Unified.Join
Hylograph.Unified.Sugar