Skip to content

interpolateX

Read as Markdown

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.

Samples sorted recorded observations without bridging explicit data gaps.

interpolateX: <D>(options: InterpolateXOptions<D>) => HoverQuery<HoverSample<D>>

Related API: interpolateX, InterpolateXOptions, HoverQuery, HoverSample.

A query producing an interpolated sample, or undefined when sampling is unavailable. See HoverQuery , HoverSample .

InterpolateXOptions

HoverQuery

HoverSample

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

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.

ClosestXOptions

HoverInterpolation

interpolateX

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

interpolation
readonly interpolation: HoverInterpolation

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

Maximum 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" | undefined

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

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.

HoverHit

HoverPoint

interpolateX

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

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

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

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

Read the Data visualization 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.