interpolateX
Import from @pibbl/core/viz. Creates a query for an exact observation or a data-space estimate at x.
interpolateX({series,x,xScale,yScale,interpolation,maxGap?,duplicateX?}) returns a function for HoverData. Source x must be nondecreasing; missing/undefined rows break segments. Duplicates error unless explicitly resolved with first/last. There is no extrapolation or gap bridging; maxGap limits bracketing intervals in domain units. Results distinguish exact original observations from interpolated values with before/after source records, indices, fraction, and mapped anchor.
API details from source
Section titled “API details from source”
interpolateX
Section titled “interpolateX”Samples sorted recorded observations without bridging explicit data gaps.
interpolateX: <D>(options: InterpolateXOptions<D>) => HoverQuery<HoverSample<D>>Related API: interpolateX, InterpolateXOptions, HoverQuery, HoverSample.
Parameters
Section titled “Parameters”options— Series, horizontal sampling, and interpolation policy. See InterpolateXOptions .
Returns
Section titled “Returns”A query producing an interpolated sample, or undefined when sampling is unavailable. See HoverQuery , HoverSample .
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-queries.ts:181
InterpolateXOptions
Section titled “InterpolateXOptions”Interpolation, gap, and duplicate-x policies for sampling a series at a requested x.
interface InterpolateXOptions<D> extends Omit<ClosestXOptions<D>, "maxDelta">Related API: InterpolateXOptions, ClosestXOptions.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:239
Properties and methods
Section titled “Properties and methods”
interpolation
readonly interpolation: HoverInterpolationRelated API: HoverInterpolation.
Computes y between the neighboring samples at the requested fraction. See HoverInterpolation.
View source — packages/core/src/features/viz/lib/hover-types.ts:241
maxGap (optional)
readonly maxGap?: number | undefinedMaximum gap between neighboring samples that permits interpolation. See InterpolateXOptions.
View source — packages/core/src/features/viz/lib/hover-types.ts:246
duplicateX (optional)
readonly duplicateX?: "error" | "first" | "last" | undefinedPolicy for resolving samples with the same x coordinate. See InterpolateXOptions.
View source — packages/core/src/features/viz/lib/hover-types.ts:248
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
HoverSample
Section titled “HoverSample”An exact datum hit or an interpolated value with its neighboring data and anchor.
Full type declaration
type HoverSample<D> = | (HoverHit<D> & { /** Selects the kind of geometry, material, or result. See {@link HoverSample}. */ readonly kind: "exact"; }) | { /** Selects the kind of geometry, material, or result. See {@link HoverSample}. */ readonly kind: "interpolated"; /** * Horizontal coordinate or displacement in the containing coordinate system. See * {@link HoverSample}. */ readonly x: number; /** * Vertical coordinate or displacement in the containing coordinate system. See * {@link HoverSample}. */ readonly y: number; /** Source datum preceding the interpolated x coordinate. See {@link HoverSample}. */ readonly before: D; /** Source datum following the interpolated x coordinate. See {@link HoverSample}. */ readonly after: D; /** Source index of the sample before the interpolated position. See {@link HoverSample}. */ readonly beforeIndex: number; /** Source index of the sample after the interpolated position. See {@link HoverSample}. */ readonly afterIndex: number; /** Normalized share or position represented by this value. See {@link HoverSample}. */ readonly fraction: number; /** Logical point to which the content or result is anchored. See {@link HoverPoint}. */ readonly anchor: HoverPoint; }Related API: HoverSample, HoverHit, displacement, HoverPoint.
See also
Section titled “See also”View source — packages/core/src/features/viz/lib/hover-types.ts:257
Properties and methods
Section titled “Properties and methods”
kind
readonly kind: "exact" | "interpolated"Selects the kind of geometry, material, or result. See HoverSample.
View source — packages/core/src/features/viz/lib/hover-types.ts:264
x
readonly x: numberHorizontal coordinate or displacement in the containing coordinate system. See HoverSample. Horizontal coordinate or displacement in the containing coordinate system. See HoverHit.
View source — packages/core/src/features/viz/lib/hover-types.ts:269
y
readonly y: numberVertical coordinate or displacement in the containing coordinate system. See HoverSample. Vertical coordinate or displacement in the containing coordinate system. See HoverHit .
View source — packages/core/src/features/viz/lib/hover-types.ts:274
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:286
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”- 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 272a94a. ALPHA — NOT FOR PRODUCTION USE.