Skip to content

LineSeries

Read as Markdown

Import LineSeries and its types from @pibbl/core/viz. LineSeriesProps<D> requires data, x, y, xScale, and yScale. Data is a readonly array or a core signal of an array. It is not a thunk. Replace arrays to notify consumers; mutation alone is not reactive.

LineAccessor<D> accepts a property key whose value is a LineCoordinate, or (datum, index, data) => LineCoordinate. A coordinate is a number, null, or undefined. Function accessors run during component evaluation; signal reads inside them belong to the series. Row fields are not recursively unwrapped.

defined(datum, index, data) runs before coordinate accessors. False, missing, NaN, or infinite coordinates split the line into separate runs. Isolated points paint nothing. Input order is preserved; points are never sorted. LineCurve supports "linear" (the default) or a named immutable step or monotone definition.

LineSeriesStyle is one static style across every run, with signal-valued whole style/direct fields: stroke (default #2563eb), strokeWidth (2), opacity (1), cursor, and lineInteractionWidth (defaults to strokeWidth). Widths must be finite and nonnegative; opacity is between 0 and 1. No per-datum style callback, segment styling or fill is implemented here; compose AreaSeries for filled geometry.

One core Path owns the complete batch’s paint and stroke hit geometry. Ordinary core event handlers and pointerEvents work on that target; gaps remain gaps for hit testing. There is no nearest-point event enrichment. Applications can compose inspection or brushing with useLinearScale and core targets. Wrap the series in a core Clip for clipping; scales do not clip automatically.

LineSeries, PointSeries, and PlotSeries accept SeriesAccessor<D> for x/y. It extracts SeriesCoordinate = number | string | null | undefined. PointScale maps string and finite numeric categories without coercion: 1 and "1" remain different identities. Unknown categories throw RangeError. Continuous scales require numbers and reject strings. Null, undefined, and nonfinite numbers create gaps (or omit isolated marks). BarScale is not a point-position scale.

Source order determines line traversal and is never sorted. PointScale reversal changes placement without changing datum identity. Domain/data signals and nested scale lookup retain ordinary reactive ownership. Application code supplies category inspection through the dedicated usePointScale mapping/inversion; numeric query helpers and PointAccessor remain numeric contracts.

LineAccessor remains the numeric accessor for area/band bounds and numeric operations. Neither accessor type can statically prove that an arbitrary scale ID refers to the matching provider; runtime validation enforces that relationship.

Draws a scaled line through defined data values, leaving gaps for undefined values.

LineSeries: <D>({ data: dataInput, x: xInput, y: yInput, xScale: xId, yScale: yId, defined, curve, style: styleInput, ...eventProps }: LineSeriesProps<D>) => JSX.Element

Related API: LineSeries, LineSeriesProps, JSX.

  • props — Data, coordinate accessors, scales, and line styling. See LineSeriesProps.

Pibbl nodes drawing the data as a line series.

LineSeriesProps

View source — packages/core/src/features/viz/lib/line-series.tsx:24

A numeric series coordinate, or a missing value that can create a gap.

type LineCoordinate = number | null | undefined

Related API: LineCoordinate.

LineAccessor

View source — packages/core/src/features/viz/lib/types.ts:387

A data property or callback that extracts a numeric series coordinate.

type LineAccessor<D> = | { [K in keyof D]-?: D[K] extends LineCoordinate ? K : never }[keyof D]
| ((datum: D, index: number, data: readonly D[]) => LineCoordinate)

Related API: LineAccessor, LineCoordinate.

  • datum — Datum whose coordinate is being read.

  • index — Zero-based index in the source data.

  • data — Complete source data array.

The datum’s coordinate, including the supported missing-value sentinel. See LineCoordinate .

LineCoordinate

LineSeriesProps

PointAccessor

View source — packages/core/src/features/viz/lib/types.ts:401

Extracts one position for a line, point, or custom mark.

type SeriesAccessor<D> = | { [K in keyof D]-?: D[K] extends SeriesCoordinate ? K : never }[keyof D]
| ((datum: D, index: number, data: readonly D[]) => SeriesCoordinate)

Related API: SeriesAccessor, SeriesCoordinate.

  • datum — Original record.

  • index — Original record index.

  • data — Complete source records.

A numeric or categorical position. See SeriesCoordinate.

LineSeriesProps

View source — packages/core/src/features/viz/lib/types.ts:414

A numeric or categorical position, or a missing value.

type SeriesCoordinate = number | string | null | undefined

Related API: SeriesCoordinate.

SeriesAccessor

View source — packages/core/src/features/viz/lib/types.ts:405

The supported interpolation mode for a line series.

type LineCurve = "linear" | SeriesCurve

Related API: LineCurve, SeriesCurve.

LineSeriesProps

View source — packages/core/src/features/viz/lib/types.ts:422

Supported geometry and presentation properties for LineSeries.

interface LineSeriesStyle

Related API: LineSeriesStyle.

StrokeStyle

LineSeriesProps

View source — packages/core/src/features/viz/lib/types.ts:429

stroke (optional)
readonly stroke?: StrokeStyle | undefined

Related API: StrokeStyle.

Paint used for the outline. See StrokeStyle.

View source — packages/core/src/features/viz/lib/types.ts:431

strokeWidth (optional)
readonly strokeWidth?: number | undefined

Width of the painted outline. See LineSeriesStyle.

View source — packages/core/src/features/viz/lib/types.ts:433

opacity (optional)
readonly opacity?: number | undefined

Related API: opacity.

Opacity of the painted result. See LineSeriesStyle.

View source — packages/core/src/features/viz/lib/types.ts:435

cursor (optional)
readonly cursor?: string | undefined

Cursor shown while this target owns pointer presentation. See LineSeriesStyle.

View source — packages/core/src/features/viz/lib/types.ts:437

lineInteractionWidth (optional)
readonly lineInteractionWidth?: number | undefined

Width used for line hit testing independently of the visible stroke width. See LineSeriesStyle.

View source — packages/core/src/features/viz/lib/types.ts:442

Authored inputs for LineSeries, including the declared data and presentation options.

interface LineSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions

Related API: LineSeriesProps, PibblEventHandlers, PibblEventParticipationOptions.

PibblEventHandlers

PibblEventParticipationOptions

SignalValue

LineAccessor

ScaleId

LineCurve

SignalStyle

LineSeriesStyle

View source — packages/core/src/features/viz/lib/types.ts:456

data
readonly data: SignalValue<readonly D[]>

Related API: SignalValue.

Application data supplied to the component or reported by the event. See SignalValue.

View source — packages/core/src/features/viz/lib/types.ts:461

x
readonly x: SeriesAccessor<D>

Related API: SeriesAccessor.

Property key or callback extracting the horizontal domain coordinate. See LineAccessor.

View source — packages/core/src/features/viz/lib/types.ts:463

y
readonly y: SeriesAccessor<D>

Related API: SeriesAccessor.

Property key or callback extracting the vertical domain coordinate. See LineAccessor.

View source — packages/core/src/features/viz/lib/types.ts:465

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/types.ts:467

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/types.ts:469

defined (optional)
readonly defined?: ((datum: D, index: number, data: readonly D[]) => boolean) | undefined

Returns whether a datum contributes drawable or queryable coordinates. See LineSeriesProps.

  • datum — Datum to test.

  • index — Zero-based index in the source data.

  • data — Complete source data array.

Whether this datum should participate in the series or query.

View source — packages/core/src/features/viz/lib/types.ts:478

curve (optional)
readonly curve?: LineCurve | undefined

Related API: LineCurve.

Interpolation mode used to connect successive defined samples. See LineCurve.

View source — packages/core/src/features/viz/lib/types.ts:480

style (optional)
readonly style?: SignalValue<Readonly<{ readonly stroke?: SignalValue<StrokeStyle | undefined>; readonly strokeWidth?: SignalValue<number | undefined>; readonly opacity?: SignalValue<number | undefined>; readonly cursor?: SignalValue<string | undefined>; readonly lineInteractionWidth?: SignalValue<number | undefined>; }>> | undefined

Related API: SignalValue, StrokeStyle, opacity.

Declared presentation and layout properties. See SignalValue, SignalStyle, LineSeriesStyle.

View source — packages/core/src/features/viz/lib/types.ts:485

pointerEvents (optional)
readonly pointerEvents?: PibblPointerEvents | undefined

Related API: PibblPointerEvents.

Whether this content participates in pointer targeting. See PibblPointerEvents.

View source — packages/core/src/lib/events/types.ts:126

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.