closestX
Import from @pibbl/core/viz. Creates a query for the recorded observation nearest a domain x value.
closestX({series,x,xScale,yScale,maxDelta?}) returns a function for HoverData. The x input is a domain number or null, plain or signal. It ignores cursor y, accepts unsorted data, and returns the original datum/index, domain x/y, mapped anchor, and delta. Inclusive maxDelta is in domain units; earliest source row wins ties.
API details from source
Section titled “API details from source”
closestX
Section titled “closestX”Selects a recorded observation by domain-x distance, independently of pointer y.
closestX: <D>(options: ClosestXOptions<D>) => HoverQuery<ClosestXHit<D>>Related API: closestX, ClosestXOptions, HoverQuery, ClosestXHit.
Parameters
Section titled “Parameters”options— Series and horizontal-distance policy. See ClosestXOptions.
Returns
Section titled “Returns”A query selecting the nearest horizontal match, or undefined when none qualifies. See HoverQuery , ClosestXHit .
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-queries.ts:109
ClosestXOptions
Section titled “ClosestXOptions”A series, x-coordinate, scales, and optional maximum x delta for hover selection.
interface ClosestXOptions<D>Related API: ClosestXOptions.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:188
Properties and methods
Section titled “Properties and methods”
series
readonly series: HoverSeries<D>Related API: HoverSeries.
The named series or series collection participating in the query. See HoverSeries.
View source — packages/core/src/features/viz/lib/hover-types.ts:190
x
readonly x: SignalValue<number | null>Related API: SignalValue.
Horizontal coordinate or displacement in the containing coordinate system. See SignalValue.
View source — packages/core/src/features/viz/lib/hover-types.ts:195
xScale
readonly xScale: ScaleIdRelated API: ScaleId.
The scale used to map horizontal data coordinates. See ScaleId.
View source — packages/core/src/features/viz/lib/hover-types.ts:197
yScale
readonly yScale: ScaleIdRelated API: ScaleId.
The scale used to map vertical data coordinates. See ScaleId.
View source — packages/core/src/features/viz/lib/hover-types.ts:199
maxDelta (optional)
readonly maxDelta?: number | undefinedMaximum x-coordinate difference accepted by the query. See ClosestXOptions.
View source — packages/core/src/features/viz/lib/hover-types.ts:201
ClosestXHit
Section titled “ClosestXHit”The nearest datum in x together with its delta from the query coordinate.
interface ClosestXHit<D> extends HoverHit<D>Related API: ClosestXHit, HoverHit.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:209
Properties and methods
Section titled “Properties and methods”
delta
readonly delta: numberDifference between the selected datum’s x coordinate and the query x coordinate. See ClosestXHit.
View source — packages/core/src/features/viz/lib/hover-types.ts:214
datum
readonly datum: DThe original data item selected by this result. See HoverHit.
View source — packages/core/src/features/viz/lib/hover-types.ts:106
index
readonly index: numberIndex of the selected datum in its source data. See HoverHit.
View source — packages/core/src/features/viz/lib/hover-types.ts:108
x
readonly x: numberHorizontal coordinate or displacement in the containing coordinate system. See HoverHit.
View source — packages/core/src/features/viz/lib/hover-types.ts:113
y
readonly y: numberVertical coordinate or displacement in the containing coordinate system. See HoverHit .
View source — packages/core/src/features/viz/lib/hover-types.ts:118
anchor
readonly anchor: HoverPointRelated API: HoverPoint.
Logical point to which the content or result is anchored. See HoverPoint.
View source — packages/core/src/features/viz/lib/hover-types.ts:120
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Authoring, signals, and lifecycle companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Hover query helpers: Run closest-point, closest-x, and interpolated-x queries against a scale context. Plain source
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.