API Reference
This section contains the auto-generated API reference for d3-blueprint, plus this hand-written overview.
Core Classes
D3Blueprint
The base class for all charts. Subclass it, define layers in initialize(), and call draw(data) to render. Provides lifecycle hooks (transform, preDraw, postDraw, postTransition), config management, event dispatch, and attachment composition.
Layer
Manages a single D3 data-join lifecycle. Created via chart.layer(name, selection, options). Handles data binding, element insertion, and ordered lifecycle events (enter, update, merge, exit) with transition support.
ConfigManager
Manages named configuration properties with optional getter/setter transforms. Used internally by D3Blueprint, but you typically interact with it through chart.config() and chart.configDefine().
Key Types
| Type | Description |
|---|---|
| D3Selection | Generic D3 selection type |
| D3Transition | Generic D3 transition type |
| LayerOptions | Options for creating a layer (dataBind, insert, events) |
| LayerEventMap | Map of lifecycle event keys to handler functions |
| LifecycleHandler | Handler for non-transition lifecycle phases |
| TransitionHandler | Handler for :transition lifecycle phases |
| ConfigDefineOptions | Options for configDefine() (defaultValue, getter, setter) |
Constants and Utilities
| Export | Description |
|---|---|
| LIFECYCLE_EVENT_NAMES | ['update', 'enter', 'merge', 'exit'] |
| isValidLifecycleEvent | Type guard for lifecycle event keys |
| assertLifecycleEvent | Assertion for lifecycle event keys |