Module

DataViz.Layout.Hierarchy.Types

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

DataViz.Layout.Hierarchy.Types

Pure PureScript implementation of D3 hierarchy types. Follows D3's conceptual model but uses separate types for each processing phase.

#HierarchyNode Source

data HierarchyNode a

Basic hierarchy node after construction Analogous to D3's Node structure but without layout-specific fields Type parameter a represents the user's data type

Note: This is a data type (not newtype or type synonym) to allow:

  1. Recursive definition without cycles
  2. Pattern matching
  3. Direct field access via record syntax

Constructors

Instances

#ValuedNode Source

data ValuedNode a

Node with computed value (after calling .sum() or .count()) This is a separate type to ensure type safety - can't use value before computing it

Constructors

Instances

#getData Source

getData :: forall a. HierarchyNode a -> a

Helper functions to access node fields

#getDepth Source

getDepth :: forall a. HierarchyNode a -> Int

#getHeight Source

getHeight :: forall a. HierarchyNode a -> Int

#getParent Source

#getChildren Source

#getValuedData Source

getValuedData :: forall a. ValuedNode a -> a

Helper functions for ValuedNode

#getValue Source

getValue :: forall a. ValuedNode a -> Number

#getValuedDepth Source

getValuedDepth :: forall a. ValuedNode a -> Int

#getValuedHeight Source

getValuedHeight :: forall a. ValuedNode a -> Int

#getValuedChildren Source

#HierarchyConfig Source

type HierarchyConfig a = { children :: a -> Maybe (Array a) }

Configuration for hierarchy construction

#Hierarchy Source

type Hierarchy a = HierarchyNode a

Result of hierarchy construction Just a type alias for clarity

#ValuedHierarchy Source

type ValuedHierarchy a = ValuedNode a

Result of sum/count operations Just a type alias for clarity