Module

DataViz.Layout.Hierarchy.EdgeBundle.BundleCurve

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

DataViz.Layout.Hierarchy.EdgeBundle.BundleCurve

Bundle curve generator for hierarchical edge bundling. Implements Danny Holten's algorithm with adjustable beta (tension) parameter.

The bundle curve draws a smooth B-spline through a path of ancestor nodes:

  • beta = 0: straight line from source to target
  • beta = 1: curve goes through all ancestor nodes
  • beta = 0.85: D3's default, good balance of bundling and readability

#bundlePath Source

bundlePath :: Number -> Array BundlePoint -> String

Generate SVG path for a bundle curve given points Uses quadratic Bezier spline approximation with bundle tension

The beta parameter controls tension:

  • beta = 0: control points are not adjusted (straight-ish curve)
  • beta = 1: control points follow the path exactly (maximum bundling)

#bundlePathRadial Source

bundlePathRadial :: Number -> Array { angle :: Number, radius :: Number } -> String

Generate bundle path from radial coordinates Takes (angle, radius) pairs and converts to Cartesian for rendering

#bundlePathCartesian Source

bundlePathCartesian :: Number -> Array { x :: Number, y :: Number } -> String

Generate bundle path from Cartesian coordinates directly

#BundlePoint Source

type BundlePoint = { x :: Number, y :: Number }

A point on the bundle path

#beta Source

beta :: Number

Default beta (tension) value - D3's default