closestPoint
Import from @pibbl/core/viz. Creates a function selecting the closest mapped observation across named series.
data accepts a readonly array or signal; x, y, and optional defined describe eligibility without invoking renderers. No subscription or scan occurs when constructing a descriptor or query.
position is a local point or null (plain or signal), xScale/yScale name providers, and series is a record of descriptors. Optional inclusive maxDistance uses local pixels. Ties follow record key then source order. Result includes original datum/index, series key, domain x/y, mapped anchor, and distance. Empty/null inspection returns undefined.
API details from source
Section titled “API details from source”
closestPoint
Section titled “closestPoint”Creates an ordinary query function for the closest mapped recorded point.
closestPoint: <S extends HoverSeriesMap>(options: ClosestPointOptions<S>) => HoverQuery<ClosestPointHit<S>>Related API: closestPoint, HoverSeriesMap, ClosestPointOptions, HoverQuery, ClosestPointHit.
Parameters
Section titled “Parameters”options— Series and distance policy for the hover query. See ClosestPointOptions.
Returns
Section titled “Returns”A query that selects the closest eligible point, or yields undefined when none qualifies. See HoverQuery , ClosestPointHit .
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-queries.ts:43
HoverPoint
Section titled “HoverPoint”A logical point used to query or anchor hover presentation.
interface HoverPointRelated API: HoverPoint.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:85
Properties and methods
Section titled “Properties and methods”
x
readonly x: numberHorizontal coordinate or displacement in the containing coordinate system. See HoverPoint.
View source — packages/core/src/features/viz/lib/hover-types.ts:90
y
readonly y: numberVertical coordinate or displacement in the containing coordinate system. See HoverPoint.
View source — packages/core/src/features/viz/lib/hover-types.ts:95
HoverHit
Section titled “HoverHit”The selected datum, source index, coordinates, and presentation anchor of a hover result.
interface HoverHit<D>Related API: HoverHit.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:104
Properties and methods
Section titled “Properties and methods”
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
ClosestPointHit
Section titled “ClosestPointHit”A closest-point result retaining the selected series identity and distance.
type ClosestPointHit<S extends HoverSeriesMap> = { [K in keyof S & string]: S[K] extends HoverSeries<infer D> ? HoverHit<D> & { /** * The named series or series collection participating in the query. See * {@link ClosestPointHit}. */ readonly series: K; /** Distance measured in this query or guide's coordinate system. See {@link ClosestPointHit}. */ readonly distance: number; } : never;}[keyof S & string]Related API: ClosestPointHit, HoverSeriesMap, HoverSeries, HoverHit.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:139
Properties and methods
Section titled “Properties and methods”
datum
readonly datum: unknownThe 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
series
readonly series: keyof S & stringThe named series or series collection participating in the query. See ClosestPointHit.
View source — packages/core/src/features/viz/lib/hover-types.ts:146
distance
readonly distance: numberDistance measured in this query or guide’s coordinate system. See ClosestPointHit.
View source — packages/core/src/features/viz/lib/hover-types.ts:148
ClosestPointOptions
Section titled “ClosestPointOptions”Series, query point, scales, and distance limit for closest-point hover selection.
interface ClosestPointOptions<S extends HoverSeriesMap>Related API: ClosestPointOptions, HoverSeriesMap.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:161
Properties and methods
Section titled “Properties and methods”
series
readonly series: SThe named series or series collection participating in the query. See ClosestPointOptions.
View source — packages/core/src/features/viz/lib/hover-types.ts:166
position
readonly position: SignalValue<HoverPoint | null>Related API: SignalValue, HoverPoint.
Position of the geometry, source, or selected resize handle. See SignalValue, HoverPoint.
View source — packages/core/src/features/viz/lib/hover-types.ts:171
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:173
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:175
maxDistance (optional)
readonly maxDistance?: number | undefinedMaximum distance accepted by the query. See ClosestPointOptions.
View source — packages/core/src/features/viz/lib/hover-types.ts:177
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.