Series curve definitions
Import from @pibbl/core/viz:
monotoneX(): SeriesCurve: smooth cubic connections preserving each adjacent pair’s extrema.stepBefore(): SeriesCurve: jump to the next y at the preceding x, then travel horizontally.stepAfter(): SeriesCurve: hold the preceding y until the next x, then jump.stepMidpoint(): SeriesCurve: hold until the midpoint between x positions, jump, then hold the next y.
Each returns one immutable opaque definition with the same fixed contract. It
accepts no options and owns no resources. No generic family selector or custom
curve implementation API is exposed. Pass a definition as curve on LineSeries,
AreaSeries, or IntervalBandSeries. Omission and curve="linear" preserve straight
segments. Definitions are ordinary values; read a signal in the component to
select a definition reactively. A signal is not itself a curve definition.
Forged objects and unknown strings throw TypeError, including for empty data.
Algorithms operate on mapped local coordinates and preserve source order, observed endpoints, missing runs, transforms, and clipping. Step definitions also preserve duplicate x values. Before/after refer to traversal order even for descending x. Midpoint means halfway in mapped coordinates (so it is a geometric midpoint on nonlinear scales). An interval’s two boundaries use the same jump positions; reversing its lower outline does not reverse the chosen transition policy. Step strategies cannot invent intermediate extrema or invert an ordered interval.
A vertical jump contains both adjacent y values geometrically. Inspection in
these demos selects an original observation (nearest x; ties follow source order),
not a value inferred from the jump. interpolateX remains a linear data estimate;
it does not silently acquire the displayed curve’s semantics. No added point
is claimed to be a measurement. Use ordinary observed-data inspection unless
an application explicitly defines a different estimate.
The policy-rate steps example uses real Federal Reserve target ranges. Only stepAfter represents policy held until the next effective date; other choices visibly demonstrate geometry, not historical policy paths. Date positions have day precision, not intraday timing.
Monotone x
Section titled “Monotone x”monotoneX() requires strictly ascending or strictly descending mapped x within
each finite run. Duplicate x or a change in direction throws RangeError; data is
never sorted. A collapsed x range is therefore invalid for a multi-point run.
Flat y intervals stay flat and local extrema have zero slope. With nonlinear
scales, the smooth shape is defined in mapped coordinates. No smoothing crosses
a missing-value gap.
Interval bands validate the difference between generated cubic boundaries at endpoints and all interior derivative roots. If smooth boundaries cross, the band throws RangeError rather than silently drawing an inverted interval. Comparison uses a 64-machine-epsilon tolerance relative to the segment’s largest boundary difference control, solely for floating-point tangency error; geometry is not adjusted. Use linear or step connections for data whose independent smooth bounds cross.
The monthly CO₂ example compares linear and monotone line/area geometry with observed-value inspection. Smoothing does not create measurements, estimates of uncertainty, or new query semantics.
API details from source
Section titled “API details from source”
SeriesCurve
Section titled “SeriesCurve”An opaque immutable definition controlling how a series connects adjacent observations.
Obtain a definition from one of the named curve factories. Definitions intentionally expose no algorithm selector or custom callback surface.
interface SeriesCurveRelated API: SeriesCurve.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/curve-definition.ts:36
stepBefore
Section titled “stepBefore”Returns the immutable definition that jumps to the next value at the prior x coordinate.
stepBefore: () => SeriesCurveRelated API: stepBefore, SeriesCurve.
Returns
Section titled “Returns”The named SeriesCurve definition.
View source — packages/core/src/features/viz/lib/step-curves.ts:55
stepAfter
Section titled “stepAfter”Returns the immutable definition that holds the prior value until the next x coordinate.
stepAfter: () => SeriesCurveRelated API: stepAfter, SeriesCurve.
Returns
Section titled “Returns”The named SeriesCurve definition.
View source — packages/core/src/features/viz/lib/step-curves.ts:64
stepMidpoint
Section titled “stepMidpoint”Returns the immutable definition that places each value transition halfway between x values.
stepMidpoint: () => SeriesCurveRelated API: stepMidpoint, SeriesCurve.
Returns
Section titled “Returns”The named SeriesCurve definition.
View source — packages/core/src/features/viz/lib/step-curves.ts:73
monotoneX
Section titled “monotoneX”Returns the immutable monotone-X cubic Hermite definition.
It uses weighted harmonic interior slopes and limited one-sided endpoint slopes, preserving every observation, flat segment, and local extremum without sorting data. Each run must have strictly ascending or strictly descending x coordinates.
monotoneX: () => SeriesCurveRelated API: monotoneX, SeriesCurve.
Returns
Section titled “Returns”The named SeriesCurve definition.
View source — packages/core/src/features/viz/lib/monotone-curve.ts:86
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Data visualization companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Named step definitions: Compare before, midpoint, and after jumps between the same endpoints. Plain source
- Monotone observations: Smooth measured observations without introducing extrema. Plain source
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.