Skip to content

closestX

Read as Markdown

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.

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.

A query selecting the nearest horizontal match, or undefined when none qualifies. See HoverQuery , ClosestXHit .

ClosestXOptions

HoverQuery

ClosestXHit

View source — packages/core/src/features/viz/lib/hover-queries.ts:109

A series, x-coordinate, scales, and optional maximum x delta for hover selection.

interface ClosestXOptions<D>

Related API: ClosestXOptions.

HoverSeries

SignalValue

ScaleId

InterpolateXOptions

closestX

View source — packages/core/src/features/viz/lib/hover-types.ts:188

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: ScaleId

Related 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: ScaleId

Related 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 | undefined

Maximum x-coordinate difference accepted by the query. See ClosestXOptions.

View source — packages/core/src/features/viz/lib/hover-types.ts:201

The nearest datum in x together with its delta from the query coordinate.

interface ClosestXHit<D> extends HoverHit<D>

Related API: ClosestXHit, HoverHit.

HoverHit

closestX

View source — packages/core/src/features/viz/lib/hover-types.ts:209

delta
readonly delta: number

Difference 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: D

The original data item selected by this result. See HoverHit.

View source — packages/core/src/features/viz/lib/hover-types.ts:106

index
readonly index: number

Index 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: number

Horizontal 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: number

Vertical 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: HoverPoint

Related 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

Read the Authoring, signals, and lifecycle companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.