Askr documentation
Generated API snapshot

@askrjs/charts

Exports from the declarations published in @askrjs/charts. Signatures reflect the published artifact.

Exports

This entrypoint publishes 100 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

AggregatedNumericChannelInputtype

AggregatedNumericChannelInput: RowChannelInput<Row, number> | ChannelExpression<number, NumericField<Row>, "count" | "sum" | "mean" | "stack" | "normalize">

A numeric channel input that may additionally be an aggregate expression.

AggregateOperationtype

AggregateOperation: "count" | "sum" | "mean"

Aggregate operations supported by grouping expressions.

appendPlotRowstype

appendPlotRows: <Row>(rows: readonly Row[], appended: readonly Row[] | Row) => readonly Row[]

Appends one or more rows to `rows`, returning a new frozen array (or `rows` if nothing was added).

ArcPropstype

ArcProps: any

Props for `Plot.Arc`.

category
category?: RowColorChannelInput<Row> | undefined;
colorScale
colorScale?: string | undefined;
cornerRadius
cornerRadius?: number | undefined;
data
data?: PlotData<Row> | undefined;
endAngle
endAngle?: number | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
innerRadius
innerRadius?: number | undefined;
key
key?: PlotRowKey<Row> | undefined;
max
max?: number | undefined;
min
min?: number | undefined;
opacity
opacity?: number | undefined;
outerRadius
outerRadius?: number | undefined;
padAngle
padAngle?: number | undefined;
startAngle
startAngle?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
value
value: RowNumericChannelInput<Row>;
xScale
xScale?: string | undefined;
yScale
yScale?: string | undefined;

AreaPropstype

AreaProps: any

Props for `Plot.Area`.

baseline
baseline?: number | undefined;
colorScale
colorScale?: string | undefined;
curve
curve?: "step" | "linear" | "monotone" | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
normalize
normalize?: boolean | undefined;
opacity
opacity?: number | undefined;
stack
stack?: boolean | CategoricalField<Row> | RowAccessor<Row, PlotScalar> | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x: BinnedScaleChannelInput<Row>;
x2
x2?: unknown;
xScale
xScale?: string | undefined;
y
y: AggregatedNumericChannelInput<Row>;
y2
y2?: RowNumericChannelInput<Row> | undefined;
yScale
yScale?: string | undefined;

AxisOrientationtype

AxisOrientation: "top" | "right" | "bottom" | "left"

The side of the plot an axis is rendered on.

AxisPropstype

AxisProps: any

Props for `Plot.Axis`.

axis
axis?: CartesianAxis | undefined;
grid
grid?: boolean | undefined;
label
label?: string | undefined;
orient
orient?: AxisOrientation | undefined;
scale
scale?: string | undefined;
tickCount
tickCount?: number | undefined;
tickFormat
tickFormat?: ((value: ScaleValue) => string) | undefined;

BarPropstype

BarProps: any

Props for `Plot.Bar`.

colorScale
colorScale?: string | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
inset
inset?: number | undefined;
key
key?: PlotRowKey<Row> | undefined;
max
max?: number | undefined;
min
min?: number | undefined;
normalize
normalize?: boolean | undefined;
opacity
opacity?: number | undefined;
orientation
orientation?: "vertical" | "horizontal" | undefined;
radius
radius?: number | undefined;
stack
stack?: boolean | CategoricalField<Row> | RowAccessor<Row, PlotScalar> | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x: BinnedScaleChannelInput<Row>;
x2
x2?: unknown;
xScale
xScale?: string | undefined;
y
y: AggregatedNumericChannelInput<Row>;
y2
y2?: unknown;
yScale
yScale?: string | undefined;

bintype

bin: { <Field extends string>(input: Field, options?: BinOptions): ChannelExpression<number | Date, Field, "bin">; <Row>(input: ChannelInput<Row, number | Date>, options?: BinOptions): ChannelExpression<number | Date, never, "bin">; }

Bins a numeric or temporal channel into discrete intervals.

BinnedScaleChannelInputtype

BinnedScaleChannelInput: RowChannelInput<Row, string | number | Date> | ChannelExpression<number | Date, NumericField<Row> | TemporalField<Row>, "bin">

A channel input for scales that may be binned, e.g. via {@link bin }.

BinOptionstype

BinOptions: any

Options for {@link bin }.

thresholds
thresholds?: number | readonly number[];
interval
interval?: number;
domain
domain?: readonly [number | Date, number | Date];

BrushPropstype

BrushProps: any

Props for `Plot.Brush`.

axis
axis?: "x" | "y" | "xy" | undefined;
modifier
modifier?: "shift" | "none" | undefined;

CartesianAxistype

CartesianAxis: "x" | "y"

A Cartesian axis identifier.

CartesianMarkPropstype

CartesianMarkProps: any

Props shared by marks positioned on Cartesian (x/y) axes.

colorScale
colorScale?: string | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x?: unknown;
x2
x2?: unknown;
xScale
xScale?: string | undefined;
y
y?: unknown;
y2
y2?: unknown;
yScale
yScale?: string | undefined;

CategoricalFieldtype

CategoricalField: FieldOfType<Row, string | number | boolean>

Field names of `Row` holding categorical (string, number, or boolean) values.

CellPropstype

CellProps: any

Props for `Plot.Cell`.

colorScale
colorScale?: string | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
inset
inset?: number | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
value
value?: RowNumericChannelInput<Row> | undefined;
x
x: RowScaleChannelInput<Row>;
x2
x2?: unknown;
xScale
xScale?: string | undefined;
y
y: RowScaleChannelInput<Row>;
y2
y2?: unknown;
yScale
yScale?: string | undefined;

ChannelExpressiontype

ChannelExpression: any

A serialized channel transform produced by helpers such as {@link bin }, {@link sum }, or {@link stack }, and consumed by mark channel props (e.g. `x`, `y`).

__askrPlotExpression
readonly __askrPlotExpression: true;
kind
readonly kind: Kind;
input
readonly input?: unknown;
options
readonly options: Readonly<Record<string, unknown>>;
__field
readonly __field?: Field;
__value
readonly __value?: Value;

ChannelExpressionKindtype

ChannelExpressionKind: "constant" | "bin" | "count" | "sum" | "mean" | "group" | "stack" | "normalize" | "moving-window" | "moving-average" | "regression"

The discriminant `kind` values a {@link ChannelExpression} may carry.

ChannelInputtype

ChannelInput: FieldOfType<Row, Value> | RowAccessor<Row, Value> | ChannelExpression<Value, FieldOfType<Row, Value>>

Anything usable as a mark channel input: a field name, an accessor, or a channel expression.

ColorChannelInputtype

ColorChannelInput: ChannelInput<Row, string | number | boolean>

A channel input resolving to a color-scale-compatible value.

constanttype

constant: <Value>(value: Value) => ChannelExpression<Value, never, "constant">

A channel expression that always resolves to the same fixed value for every row.

counttype

count: () => ChannelExpression<number, never, "count">

Counts the number of rows in each group.

createPlottype

createPlot: <Row>() => PlotFactory<Row>

Creates a self-contained set of plot components (`Root`, marks, scales, and annotations) bound to a single row type.

const Plot = createPlot<{ x: number; y: number }>();
<Plot.Root data={rows} rowKey="x" label="Example">
  <Plot.Line x="x" y="y" />
</Plot.Root>

CrosshairPropstype

CrosshairProps: any

Props for `Plot.Crosshair`.

axes
axes?: "x" | "y" | "xy" | undefined;

FieldOfTypetype

FieldOfType: { [Field in RowField<Row>]-?: Present<Row[Field]> extends Value ? Field : never; }[RowField<Row>]

The field names of `Row` whose (non-nullable) value type is assignable to `Value`.

filterRowstype

filterRows: <Row>(predicate: (row: Readonly<Row>, index: number) => boolean) => RowTransform<Row>

A row transform that keeps only rows for which `predicate` returns true.

FollowLatesttype

FollowLatest: number | FollowLatestRows | FollowLatestTime<Row>

`RootProps.followLatest` shorthand: a bare number is treated as a row count (equivalent to `{ rows: n }`).

FollowLatestRowstype

FollowLatestRows: any

Keep only the most recent N rows; see {@link FollowLatest}.

rows
rows: number;

FollowLatestTimetype

FollowLatestTime: any

Keep only rows within a trailing time window of a temporal field; see {@link FollowLatest}.

durationMs
durationMs: number;
field
field: TemporalField<Row> | RowAccessor<Row, Date>;

GridPropstype

GridProps: any

Props for `Plot.Grid`.

axis
axis?: CartesianAxis | undefined;
scale
scale?: string | undefined;
tickCount
tickCount?: number | undefined;

grouptype

group: { <Field extends string>(input: Field): ChannelExpression<unknown, Field, "group">; <Row, Value>(input: ChannelInput<Row, Value>): ChannelExpression<Value, never, "group">; }

Groups rows by a channel's distinct values.

LegendPropstype

LegendProps: any

Props for `Plot.Legend`.

interactive
interactive?: boolean | undefined;
label
label?: string | undefined;
position
position?: "top" | "right" | "bottom" | "left" | undefined;
scale
scale?: string | undefined;

LinePropstype

LineProps: any

Props for `Plot.Line`.

colorScale
colorScale?: string | undefined;
curve
curve?: "step" | "linear" | "monotone" | undefined;
dash
Explicit stroke dash pattern. When omitted, a multi-series line mark cycles accessible dash patterns; pass an empty array to keep every series solid.
data
data?: PlotData<Row> | undefined;
defined
defined?: RowAccessor<Row, boolean> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
strokeWidth
strokeWidth?: number | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x: RowScaleChannelInput<Row>;
x2
x2?: unknown;
xScale
xScale?: string | undefined;
y
y: RowNumericChannelInput<Row>;
y2
y2?: unknown;
yScale
yScale?: string | undefined;

MarkBasePropstype

MarkBaseProps: any

Props shared by all mark components.

colorScale
colorScale?: string | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
xScale
xScale?: string | undefined;
yScale
yScale?: string | undefined;

meantype

mean: { <Field extends string>(input: Field): ChannelExpression<number, Field, "mean">; <Row>(input: NumericChannelInput<Row>): ChannelExpression<number, never, "mean">; }

Averages a numeric channel across each group.

MeterSemanticstype

MeterSemantics: any

ARIA `meter` role semantics applied to the plot's graphic region.

role
role: "meter";
min
min: number;
max
max: number;
value
value: number;
valueText
valueText?: string;

movingAveragetype

movingAverage: { <Field extends string>(input: Field, options: Omit<MovingWindowOptions, "operation">): ChannelExpression<number, Field, "moving-average">; <Row>(input: NumericChannelInput<Row>, options: Omit<MovingWindowOptions, "operation">): ChannelExpression<number, never, "moving-average">; }

Shorthand for {@link movingWindow} with `operation: "mean"`.

movingWindowtype

movingWindow: { <Field extends string>(input: Field, options: MovingWindowOptions): ChannelExpression<number, Field, "moving-window">; <Row>(input: NumericChannelInput<Row>, options: MovingWindowOptions): ChannelExpression<number, never, "moving-window">; }

Applies a sliding-window aggregate (sum, mean, min, or max) to a numeric channel.

MovingWindowOptionstype

MovingWindowOptions: any

Options for {@link movingWindow } and {@link movingAverage }.

window
window: number;
operation
operation?: WindowOperation;
partial
partial?: boolean;

normalizetype

normalize: { <Field extends string>(input: Field): ChannelExpression<number, Field, "normalize">; <Row>(input: NumericChannelInput<Row>): ChannelExpression<number, never, "normalize">; }

Normalizes a numeric channel's values within each group to a 0–1 (or proportional) range.

NumericChannelInputtype

NumericChannelInput: ChannelInput<Row, number>

A channel input resolving to a number.

NumericFieldtype

NumericField: FieldOfType<Row, number>

Field names of `Row` holding numbers.

partitiontype

partition: <Row>(options: PartitionOptions<Row>) => RowTransform<Row>

A row transform that builds a hierarchy (e.g. for treemap/icicle-style marks) from flat rows.

PartitionOptionstype

PartitionOptions: any

Options for {@link partition }.

id
id: RowField<Row> | RowAccessor<Row, PlotKey>;
parentId
parentId?: RowField<Row> | RowAccessor<Row, PlotKey | null | undefined>;
children
children?: RowField<Row> | RowAccessor<Row, readonly Row[] | null | undefined>;
value
value: RowNumericChannelInput<Row>;
padding
padding?: number;

PlotApitype

PlotApi: any

The imperative API exposed for a rendered plot, delivered via `RootProps.onApiChange`.

resetView
resetView(): void;
resumeLive
resumeLive(): void;
exportPng
exportPng(options?: PlotPngExportOptions): Promise<Blob>;
exportSvg
exportSvg(options?: PlotSvgExportOptions): string;
exportData
exportData(options?: PlotDataExportOptions): string;
rows
readonly rows: readonly Row[];

PlotChannelValuetype

PlotChannelValue: PlotScalar | null | undefined

A channel value, allowing for missing data.

PlotDatatype

PlotData: readonly Row[] | (() => readonly Row[])

The data a plot consumes: a readonly array of rows, or a function producing one.

PlotDataExportOptionstype

PlotDataExportOptions: any

Options for {@link PlotApi.exportData}.

view
view?: "current" | "full";
rows
rows?: "source" | "transformed";
scope
scope?: "all" | "visible" | "selected";
format
format?: "csv" | "json";

PlotExportViewOptionstype

PlotExportViewOptions: any

Options shared by the plot export methods that capture a rendered view.

view
view?: "current" | "full";
background
background?: string | null;

PlotFactorytype

PlotFactory: any

The set of components returned by {@link createPlot } for a given row type.

Root
readonly Root: PrimitiveComponent<RootProps<Row>>;
Scale
readonly Scale: PrimitiveComponent<ScaleProps>;
Axis
readonly Axis: PrimitiveComponent<AxisProps>;
Grid
readonly Grid: PrimitiveComponent<GridProps>;
Bar
readonly Bar: PrimitiveComponent<BarProps<Row>>;
Line
readonly Line: PrimitiveComponent<LineProps<Row>>;
Area
readonly Area: PrimitiveComponent<AreaProps<Row>>;
Point
readonly Point: PrimitiveComponent<PointProps<Row>>;
Arc
readonly Arc: PrimitiveComponent<ArcProps<Row>>;
Cell
readonly Cell: PrimitiveComponent<CellProps<Row>>;
Rect
readonly Rect: PrimitiveComponent<RectProps<Row>>;
Rule
readonly Rule: PrimitiveComponent<RuleProps<Row>>;
Text
readonly Text: PrimitiveComponent<TextProps<Row>>;
Legend
readonly Legend: PrimitiveComponent<LegendProps>;
Tooltip
readonly Tooltip: PrimitiveComponent<TooltipProps>;
Crosshair
readonly Crosshair: PrimitiveComponent<CrosshairProps>;
Select
readonly Select: PrimitiveComponent<SelectProps>;
Zoom
readonly Zoom: PrimitiveComponent<ZoomProps>;
Brush
readonly Brush: PrimitiveComponent<BrushProps>;

PlotHeadingLeveltype

PlotHeadingLevel: 1 | 2 | 3 | 4 | 5 | 6

A valid heading level (`h1`–`h6`) for `RootProps.headingLevel`.

PlotInteractionOrigintype

PlotInteractionOrigin: "pointer" | "keyboard"

How a plot interaction was triggered.

PlotInteractionTargettype

PlotInteractionTarget: any

The mark instance a pointer/keyboard interaction resolved to.

row
readonly row: Row;
key
readonly key: PlotKey;
sourceKeys
readonly sourceKeys: readonly PlotKey[];
markKind
readonly markKind: "bar" | "line" | "area" | "point" | "arc" | "cell" | "rect" | "rule" | "text";
markId
readonly markId: string;
series
readonly series: string | null;
channels
readonly channels: Readonly<Record<string, unknown>>;
origin
readonly origin: PlotInteractionOrigin;

PlotKeytype

PlotKey: string | number

A row identity: any string or number usable as a stable key for a plot row.

PlotPngExportOptionstype

PlotPngExportOptions: any

Options for {@link PlotApi.exportPng}.

pixelRatio
pixelRatio?: number;
includeOverlays
includeOverlays?: boolean;

PlotRowKeytype

PlotRowKey: FieldOfType<Row, PlotKey> | RowAccessor<Row, PlotKey>

How to derive a row's stable {@link PlotKey}: a field name or an accessor function.

PlotScalartype

PlotScalar: string | number | boolean | Date

A primitive value a plot channel may resolve to.

PlotSelectiontype

PlotSelection: any

The set of row keys currently selected via `Plot.Select`.

keys
keys: readonly PlotKey[];

PlotSummaryContexttype

PlotSummaryContext: any

Context passed to a `RootProps.summary` function to compute the plot's summary text.

rows
readonly rows: readonly Row[];
sourceRowCount
readonly sourceRowCount: number;
transformedRowCount
readonly transformedRowCount: number;
omittedRowCount
readonly omittedRowCount: number;
visibleRowCount
readonly visibleRowCount: number;

PlotSvgExportOptionstype

PlotSvgExportOptions: any

Options for {@link PlotApi.exportSvg}.

includeOverlays
includeOverlays?: boolean;

PlotViewtype

PlotView: any

The visible domain of a plot's scales, used for `view`/`defaultView`.

x
x?: readonly [ScaleValue, ScaleValue];
y
y?: readonly [ScaleValue, ScaleValue];
scales
scales?: Readonly<Record<string, readonly [ScaleValue, ScaleValue]>>;

PointPropstype

PointProps: any

Props for `Plot.Point`.

colorScale
colorScale?: string | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
r
r?: number | RowNumericChannelInput<Row> | undefined;
shape
Explicit point shape. When omitted, a multi-series point mark cycles shapes so color is not the only default series encoding.
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x: RowScaleChannelInput<Row>;
x2
x2?: unknown;
xScale
xScale?: string | undefined;
y
y: RowNumericChannelInput<Row>;
y2
y2?: unknown;
yScale
yScale?: string | undefined;

PrimitiveComponenttype

PrimitiveComponent: any

A plot component that renders `Props` to a `JSXElement`.

PrimitiveKindtype

PrimitiveKind: Exclude<keyof PlotFactory<unknown>, "Root">

The keys of {@link PlotFactory} that identify a mark/annotation primitive (excludes `Root`).

RectPropstype

RectProps: any

Props for `Plot.Rect`.

colorScale
colorScale?: string | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
radius
radius?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x?: RowScaleChannelInput<Row> | undefined;
x2
x2?: RowScaleChannelInput<Row> | undefined;
xScale
xScale?: string | undefined;
y
y?: RowScaleChannelInput<Row> | undefined;
y2
y2?: RowScaleChannelInput<Row> | undefined;
yScale
yScale?: string | undefined;

regressiontype

regression: { <Field extends string>(input: Field, options?: { x?: string; method?: "linear"; }): ChannelExpression<number, Field, "regression">; <Row>(input: NumericChannelInput<Row>, options?: RegressionOptions<Row>): ChannelExpression<number, never, "regression">; }

Fits a regression curve (currently linear) to a numeric channel against an x channel.

RegressionOptionstype

RegressionOptions: any

Options for {@link regression }.

x
x?: RowScaleChannelInput<Row>;
method
method?: "linear";

removePlotRowstype

removePlotRows: <Row>(rows: readonly Row[], keys: readonly PlotKey[] | ReadonlySet<PlotKey> | ((row: Readonly<Row>, index: number) => boolean), rowKey?: PlotRowKey<Row>) => readonly Row[]

Removes rows matching a predicate, or by key (requires `rowKey` when `keys` is an array/set). Returns the original `rows` reference unchanged if nothing was removed.

RootPropstype

RootProps: any

Props accepted by a plot factory's `Root` component.

children
children?: unknown;
class
class?: string | undefined;
data
data: PlotData<Row>;
defaultSelection
defaultSelection?: PlotSelection | undefined;
defaultView
defaultView?: PlotView | undefined;
description
description?: string | undefined;
diagnostics
diagnostics?: boolean | undefined;
empty
empty?: string | undefined;
followLatest
followLatest?: FollowLatest<Row> | undefined;
headingLevel
headingLevel?: PlotHeadingLevel | undefined;
height
height?: number | undefined;
id
id?: string | undefined;
label
label: string;
locale
locale?: string | undefined;
meter
meter?: MeterSemantics | undefined;
onActivate
onActivate?: ((row: Row, key: PlotKey, target: PlotInteractionTarget<Row>) => void) | undefined;
onApiChange
onApiChange?: ((api: PlotApi<Row> | null) => void) | undefined;
onSelectionChange
onSelectionChange?: ((selection: PlotSelection) => void) | undefined;
onViewChange
onViewChange?: ((view: PlotView) => void) | undefined;
rowKey
rowKey: PlotRowKey<Row>;
selection
selection?: PlotSelection | undefined;
style
style?: string | Record<string, string | number | false | null | undefined> | undefined;
summary
summary?: string | ((context: PlotSummaryContext<Row>) => string) | undefined;
title
title?: string | undefined;
view
view?: PlotView | undefined;
width
width?: number | undefined;

RowAccessortype

RowAccessor: (row: Readonly<Row>, index: number) => Value | null | undefined

A function that reads a channel value from a row and its index.

RowChannelInputtype

RowChannelInput: FieldOfType<Row, Value> | RowAccessor<Row, Value> | ChannelExpression<Value, FieldOfType<Row, Value>, RowExpressionKind>

A channel input restricted to row-level (non-aggregating) expression kinds.

RowColorChannelInputtype

RowColorChannelInput: RowChannelInput<Row, string | number | boolean>

{@link RowChannelInput} resolving to a color-scale-compatible value.

RowFieldtype

RowField: Extract<keyof Row, string>

The string-keyed field names of a row type.

RowNumericChannelInputtype

RowNumericChannelInput: RowChannelInput<Row, number>

{@link RowChannelInput} resolving to a number.

RowScaleChannelInputtype

RowScaleChannelInput: RowChannelInput<Row, string | number | Date>

{@link RowChannelInput} for a positional/categorical scale.

RowTextChannelInputtype

RowTextChannelInput: RowChannelInput<Row, string | number | Date | boolean>

{@link RowChannelInput} resolving to a displayable text value.

RowTransformtype

RowTransform: any

A serialized row-level transform produced by helpers such as {@link filterRows }, {@link sortRows }, or {@link partition }, and applied to a mark's `data` via `transform`.

__askrPlotTransform
readonly __askrPlotTransform: true;
kind
readonly kind: RowTransformKind;
options
readonly options: Readonly<Record<string, unknown>>;
__row
readonly __row?: (row: Row) => Row;

RowTransformKindtype

RowTransformKind: "filter" | "sort" | "partition"

The discriminant `kind` values a {@link RowTransform} may carry.

RulePropstype

RuleProps: any

Props for `Plot.Rule`.

colorScale
colorScale?: string | undefined;
dash
dash?: readonly number[] | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
strokeWidth
strokeWidth?: number | undefined;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x?: RowScaleChannelInput<Row> | undefined;
x2
x2?: RowScaleChannelInput<Row> | undefined;
xScale
xScale?: string | undefined;
y
y?: RowScaleChannelInput<Row> | undefined;
y2
y2?: RowScaleChannelInput<Row> | undefined;
yScale
yScale?: string | undefined;

ScaleChannelInputtype

ScaleChannelInput: ChannelInput<Row, string | number | Date>

A channel input for a positional/categorical scale.

ScaleDomainValuetype

ScaleDomainValue: ScaleValue | boolean

A scale domain value, including booleans (for ordinal/color scales).

ScaleFieldtype

ScaleField: FieldOfType<Row, string | number | Date>

Field names of `Row` usable as a scale channel (string, number, or Date).

ScalePropstype

ScaleProps: any

Props for `Plot.Scale`.

base
base?: number | undefined;
channel
channel?: "color" | "x" | "y" | undefined;
clamp
clamp?: boolean | undefined;
constant
constant?: number | undefined;
domain
domain?: readonly ScaleDomainValue[] | undefined;
exponent
exponent?: number | undefined;
name
name?: string | undefined;
nice
nice?: number | boolean | undefined;
padding
padding?: number | undefined;
paddingInner
paddingInner?: number | undefined;
paddingOuter
paddingOuter?: number | undefined;
range
range?: readonly (string | number)[] | undefined;
reverse
reverse?: boolean | undefined;
type
type?: ScaleType | undefined;
unknown
unknown?: string | undefined;

ScaleTypetype

ScaleType: "band" | "point" | "linear" | "power" | "log" | "symlog" | "time" | "utc" | "ordinal-color" | "continuous-color"

The scale types supported by `Plot.Scale`.

ScaleValuetype

ScaleValue: string | number | Date

A value usable as a scale domain/range endpoint.

SelectPropstype

SelectProps: any

Props for `Plot.Select`.

mode
mode?: "single" | "toggle" | undefined;

sortRowstype

sortRows: <Row>(options: SortRowsOptions<Row>) => RowTransform<Row>

A row transform that sorts rows by a field or accessor.

SortRowsOptionstype

SortRowsOptions: any

Options for {@link sortRows }.

by
by: RowField<Row> | RowAccessor<Row, unknown>;
direction
direction?: "ascending" | "descending";

stacktype

stack: { <Field extends string>(input: Field, options?: StackOptions): ChannelExpression<number, Field, "stack">; <Row>(input: NumericChannelInput<Row>, options?: StackOptions): ChannelExpression<number, never, "stack">; }

Stacks a numeric channel's values within each group, e.g. for stacked bar/area charts.

StackOptionstype

StackOptions: any

Options for {@link stack }.

offset
offset?: "zero" | "diverging" | "expand";
order
order?: "none" | "ascending" | "descending" | "inside-out";

sumtype

sum: { <Field extends string>(input: Field): ChannelExpression<number, Field, "sum">; <Row>(input: NumericChannelInput<Row>): ChannelExpression<number, never, "sum">; }

Sums a numeric channel across each group.

TemporalFieldtype

TemporalField: FieldOfType<Row, Date>

Field names of `Row` holding `Date` values.

TextChannelInputtype

TextChannelInput: ChannelInput<Row, string | number | Date | boolean>

A channel input resolving to a displayable text value.

TextPropstype

TextProps: any

Props for `Plot.Text`.

align
align?: CanvasTextAlign | undefined;
baseline
baseline?: CanvasTextBaseline | undefined;
colorScale
colorScale?: string | undefined;
data
data?: PlotData<Row> | undefined;
fill
fill?: RowColorChannelInput<Row> | undefined;
font
font?: string | undefined;
hidden
hidden?: boolean | undefined;
key
key?: PlotRowKey<Row> | undefined;
opacity
opacity?: number | undefined;
stroke
stroke?: RowColorChannelInput<Row> | undefined;
text
text: RowTextChannelInput<Row>;
title
title?: RowTextChannelInput<Row> | undefined;
transform
transform?: RowTransform<Row> | readonly RowTransform<Row>[] | undefined;
x
x: RowScaleChannelInput<Row>;
x2
x2?: unknown;
xScale
xScale?: string | undefined;
y
y: RowScaleChannelInput<Row>;
y2
y2?: unknown;
yScale
yScale?: string | undefined;

TooltipPropstype

TooltipProps: any

Props for `Plot.Tooltip`.

channels
channels?: readonly string[] | undefined;
format
format?: ((record: Readonly<Record<string, unknown>>) => string) | undefined;
mode
mode?: "x" | "auto" | "mark" | undefined;

trimPlotRowstype

trimPlotRows: <Row>(rows: readonly Row[], options: number | TrimPlotRowsOptions<Row>) => readonly Row[]

Trims `rows` down to a trailing window, either by row count or by a duration relative to a temporal field. A bare number is shorthand for `{ rows: number }`. Returns the original `rows` reference unchanged if nothing was trimmed.

TrimPlotRowsOptionstype

TrimPlotRowsOptions: {
  rows: number;
} | {
  durationMs: number;
  field: RowField<Row> | RowAccessor<Row, Date>;
  now?: Date | number;
}

Options for {@link trimPlotRows}: keep the last `rows` rows, or rows within `durationMs` of `now`.

upsertPlotRowstype

upsertPlotRows: <Row>(rows: readonly Row[], updates: readonly Row[] | Row, rowKey: PlotRowKey<Row>) => readonly Row[]

Inserts or updates rows by key: rows whose key matches an existing row replace it in place, and new keys are appended. Throws if `updates` or the existing `rows` contain duplicate keys.

WindowOperationtype

WindowOperation: "sum" | "mean" | "min" | "max"

Operations supported by moving-window expressions.

ZoomPropstype

ZoomProps: any

Props for `Plot.Zoom`.

axes
axes?: "x" | "y" | "xy" | undefined;
max
max?: number | undefined;
min
min?: number | undefined;
pan
pan?: boolean | undefined;
pinch
pinch?: boolean | undefined;
wheel
wheel?: boolean | undefined;