Published-release documentation · release compatibility

Encoding Actions

Each declared action has an exact signature and its own stable link. Option tables are generated from types; behavior prose names the owning workflow and its constraints. API layers and H0–H4 catalog role tags are independent classifications. Relative action hierarchy is determined by composition, not by a tag or fixed trace depth.

encodeX

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeX(options: PositionEncodingOptions | DatumPositionEncodingOptions): ChartProgram;

Named option contracts: PositionEncodingOptions · DatumPositionEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Optional / branch-dependent string \| undefined
target Optional / branch-dependent string \| undefined
coordinate Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent FieldType \| undefined
scale Optional / branch-dependent CategoricalPositionScaleOptions \| NonPointCategoricalPositionScaleOptions \| NonPointQuantitativePositionScaleOptions \| QuantitativePositionScaleOptions \| NonPointTemporalPositionScaleOptions \| TemporalPositionScaleOptions \| undefined
datum Optional / branch-dependent unknown
bin Optional / branch-dependent { maxBins?: number \| undefined; step?: undefined; boundaries?: undefined; } \| { maxBins?: undefined; step: number; boundaries?: undefined; } \| { maxBins?: undefined; step?: undefined; boundaries: readonly [...]; } \| undefined
stack Optional / branch-dependent StackMode \| undefined
aggregate Optional / branch-dependent AggregateOperation
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeX({ field, target?, fieldType?, aggregate?, stack?, coordinate?, bin?, scale? })
encodeX({ datum, target?, fieldType?, coordinate?, scale? }) // rule, rect, area, independent text

Create or compatibly replace an x encoding for the supported mark/type pairs in the matrix above. Rects accept a discrete x band or the primary x edge of a complete x/x2 range. Bars accept binned x, vertical categories, or a horizontal aggregate measure. Rules, Rects, and independent Text accept exactly one field or datum. Datum positions infer finite numbers as quantitative and other supported scalars as nominal; field rules require an explicit field type. All-constant independent Text materializes once; any field-bound x, y, or text encoding selects row grain. Position encodings

encodeY

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeY(options: YPositionEncodingOptions | DatumPositionEncodingOptions): ChartProgram;

Named option contracts: YPositionEncodingOptions · DatumPositionEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Optional / branch-dependent string \| undefined
target Optional / branch-dependent string \| undefined
coordinate Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent FieldType \| undefined
scale Optional / branch-dependent CategoricalPositionScaleOptions \| NonPointCategoricalPositionScaleOptions \| NonPointQuantitativePositionScaleOptions \| QuantitativePositionScaleOptions \| NonPointTemporalPositionScaleOptions \| TemporalPositionScaleOptions \| undefined
datum Optional / branch-dependent unknown
aggregate Optional / branch-dependent AggregateOperation
stack Optional / branch-dependent YStackMode \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeY({ field?, target?, fieldType?, aggregate?, stack?, coordinate?, scale? })
encodeY({ datum, target?, fieldType?, coordinate?, scale? }) // rule, rect, area, independent text

Create or compatibly replace a y encoding. With bar marks, a quantitative y measure plus ordinal/temporal x produces vertical bars; ordinal/temporal y plus a quantitative aggregate x produces horizontal bars. Orientation is inferred from the complete pair and is not stored separately. Bar stack accepts "zero", "normalize", or null. Aggregate values may be scalar names or parameterized quantile and ordered first/last objects. A complete histogram x/y pair materializes concrete rects. Rects accept a discrete y band or the primary y edge of a complete y/y2 range. Rules, Rects, and independent Text use the same datum inference as x. Attached source-owned Text continues to reject direct position replacement. Position encodings

encodeX2

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeX2(options: SecondaryPositionEncodingOptions): ChartProgram;

Named option contracts: SecondaryPositionEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
datum Optional / branch-dependent unknown
field Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| "quantitative" \| "temporal" \| undefined
target Optional / branch-dependent string \| undefined
scale Optional / branch-dependent { id?: string \| undefined; } \| { id?: string \| undefined; } \| { id?: string \| undefined; } \| undefined
coordinate Optional / branch-dependent string \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeX2({ field, target?, fieldType, scale?, coordinate? })
encodeX2({ datum, target?, fieldType?, scale?, coordinate? })

Assign an area, ranged-bar, or rect upper edge, or a rule secondary x endpoint. It requires an existing x and shares its scale and coordinate. A rule numeric datum defaults to fieldType: "quantitative" and must be finite. Rule field endpoints and nonnumeric datum endpoints require an explicit matching type. Position encodings

encodeColor

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeColor(options: ColorEncodingOptions): ChartProgram;

Named option contracts: ColorEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
value Optional / branch-dependent string \| undefined
target Optional / branch-dependent string \| undefined
field Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| "quantitative" \| "temporal" \| undefined
scale Optional / branch-dependent ContinuousColorScaleOptions \| DiscretizedColorScaleOptions \| CategoricalColorScaleOptions \| (Omit<...> & { ...; }) \| undefined
palette Optional / branch-dependent Palette \| undefined
layout Optional / branch-dependent ColorLayout \| undefined
aggregate Optional / branch-dependent AggregateOperation \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

Color capability matrix

Mode Supported marks Field types Important options
Categorical point, line, area, bar, rect, arc, text point/line/area/bar/rect/arc/text: nominal, ordinal bar/area layout; arc overlay; palette and ordinal scale; explicit-domain row-owned Cartesian line color supports unknown paint
Continuous point, aggregate bar, rect, text, area, tick point/rect/text/tick: quantitative, temporal; aggregate bar/area: quantitative sequential scale; aggregate required for a different bar measure; area requires one finite value per existing series; tick paints its centered segment and rejects simultaneous stroke
Discretized continuous point, aggregate bar, rect, text, area, tick point/aggregate bar/rect/text/area/tick: quantitative quantize, quantile, or threshold scale; area requires one finite value per existing series; tick maps colors per row
encodeColor({ field, target?, fieldType?, palette?, layout?, aggregate?, scale? })

Create or compatibly replace point fill, line-series color, grouped area fill, bar color, rect fill, or arc-sector fill. Nominal and ordinal categories share an ordinal palette scale; ordinal fields may contain ordered numeric categories. Categorical bar layout accepts stack, fill, group, overlay, and diverging; area also accepts center and rejects only group from the shared layout vocabulary. Quantitative and temporal point fields use a sequential scale; quantitative fields also accept log/sqrt/symlog with matching gradient legends. Square-root color normalizes sign-preserving square roots across the original numeric domain; negative, zero-crossing, and reversed domains are supported. Its exponent is fixed, and base, constant, and numeric midpoint are rejected. Sampled symbol legends use the same mapping. Quantitative Point, aggregate Bar, and Rect fields also accept quantize, quantile, and threshold color classes. Categorical grouped bars record encodeXOffset or encodeYOffset as a child according to orientation. Reassigning grouped color also atomically reassigns its offset and rematerializes an existing legend. Aggregate bars accept quantitative sequential or discretized color: a matching measure field inherits its aggregate, while a different field requires aggregate. Area layout: "center" creates a matching nominal group when needed and records wrapped encodeY({ stack: "center" }). It requires non-negative values aligned at every x position and stacks each partition from -total / 2. Area also accepts quantitative continuous or discretized color with exactly one finite value per existing series. Grouping and layout stay independent; no vertex gradients, aggregate, temporal color, or point-only unknown fallback are supported. Use encodeColor after a complete createAreaPlot, whose color option remains categorical. The real color scale drives fills and legends and uses one sample per series for automatic quantile domains. Basic does not expose Area authoring. Tick quantitative/temporal color paints its segment, using color gradients, intervals or samples without changing geometry. Remove the existing color or stroke encoding before switching channels or setting constant stroke. Categorical color, aggregate, layout and point-only unknown remain unsupported; Basic gains no Tick authoring.

Row-owned rects accept categorical or continuous color. Arc sectors accept categorical color with optional overlay layout, or continuous/discretized color with one value per sector. Aggregated sectors require that value to be constant within their category; no implicit color aggregation is invented. Gradient and interval legends use the same scale mapping. Automatic quantile domains use one sample per sector. When changing a target between categorical and continuous color families, an omitted scale ID detaches from an incompatible shared scale into a target-owned scale. Explicit shared IDs keep strict consumer validation. Other consumers, such as grouped regression lines, retain their original mapping. Series encodings

Existing field encodings in ggaction/basic can reassign settings on a bound scale of the same type, updating every consumer atomically. Generic/focused scale editors and legend editors remain Full-only; scale-type transitions use Full or a new scale ID in Basic. Encoding reassignment

encodeStrokeDash

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeStrokeDash(options: StrokeDashEncodingOptions): ChartProgram;

Named option contracts: StrokeDashEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Optional / branch-dependent string \| undefined
value Optional / branch-dependent DashPattern \| DashStyle \| undefined
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| undefined
scale Optional / branch-dependent DashScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeStrokeDash(
  { field, target?, fieldType?, scale? }
  | { value, target? }
)

Create or replace nominal/ordinal line-series or rule dash patterns, or apply one constant named/direct pattern. Named styles are solid, dashed, dotted, and dashdot. Cartesian line/rule scale.unknown accepts the same named or direct pattern for valid categories outside a domain; missing categories remain errors, and domain, legend and raw series identities stay unchanged. Series encodings

encodeStroke

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeStroke(options: StrokeEncodingOptions): ChartProgram;

Named option contracts: StrokeEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
value Optional / branch-dependent string \| undefined
field Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| "quantitative" \| "temporal" \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined
scale Optional / branch-dependent ContinuousColorScaleOptions \| DiscretizedColorScaleOptions \| CategoricalColorScaleOptions \| (Omit<...> & { ...; }) \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeStroke({ value, target? })
encodeStroke({ field, target?, fieldType?, temporalUnit?, scale? })

Assign a constant non-empty stroke color or map a categorical, quantitative, or temporal field to the outline of a Point, Line, Area, Bar, Rect, Arc, Rule, or Tick. Line and Area values must be constant within each final series. Constant mode clears the field binding and its own legend; field mode clears the constant override. Text outlines are outside this action. Appearance encodings

encodeStrokeWidth

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeStrokeWidth(options: StrokeWidthEncodingOptions): ChartProgram;

Named option contracts: StrokeWidthEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
value Optional / branch-dependent number \| undefined
field Optional / branch-dependent string \| undefined
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "quantitative" \| undefined
scale Optional / branch-dependent (Omit<ScaleFields<"base" \| "clamp" \| "constant" \| "exponent" \| "id" \| "reverse" \| "zero"> & { domain?: "auto" \| readonly [number, number] \| undefined; range?: "auto" \| readonly [...] \| undefined; } & { ...; }, "nice"> & { ...; }) \| (Omit<...> & { ...; }) \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeStrokeWidth({ value, target? })
encodeStrokeWidth({ field, target?, fieldType?, scale? })

Assign a non-negative finite logical Canvas width to a Line, Rule, or Rect. Field mode maps one quantitative value per rule/rect row or complete line series. Constant mode clears the field and its own sampled width legend; fieldType/scale are invalid in constant mode. Active channel selections must be removed before replacement. Appearance encodings

encodeSize

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeSize(options: SizeEncodingOptions): ChartProgram;

Named option contracts: SizeEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
value Optional / branch-dependent number \| undefined
target Optional / branch-dependent string \| undefined
field Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| "quantitative" \| undefined
scale Optional / branch-dependent SizeScaleOptions \| CategoricalSizeScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeSize({ field, target?, fieldType?, scale? })

Encode point size as area; radius-normalized polygons use reference-circle area. The automatic area range is [24, 196]. Size scales support continuous linear, log, sqrt, and pow mappings plus discrete quantize, quantile, and threshold mappings. Appearance encodings

encodeShape

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeShape(options: ShapeEncodingOptions): ChartProgram;

Named option contracts: ShapeEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Required string
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| undefined
scale Optional / branch-dependent ShapeScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeShape({ field, target?, fieldType?, scale? })

Encode a nominal field as fourteen named shapes or polygons with area/radius normalization. Explicit ranges may repeat shapes; provide one entry per domain value. Automatic ranges remain distinct. Appearance encodings

encodeAngle

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeAngle(options: AngleEncodingOptions): ChartProgram;

Named option contracts: AngleEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
value Optional / branch-dependent number \| undefined
field Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "quantitative" \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeAngle({ target?, value })
encodeAngle({ target?, field, fieldType? })

Rotate point or Tick glyphs with direct clockwise degrees: 0 points up and no scale or legend is created. Reassignment replaces the prior constant/field branch; remove it with removeEncoding({ channel: "angle" }). Encodings

encodeOpacity

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeOpacity(options: OpacityEncodingOptions): ChartProgram;

Named option contracts: OpacityEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
value Optional / branch-dependent number \| undefined
field Optional / branch-dependent string \| undefined
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "quantitative" \| undefined
scale Optional / branch-dependent OpacityScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeOpacity({ value, target? })
encodeOpacity({ field, target?, fieldType?, scale? })

Apply a constant point/rule/line/bar/rect opacity from 0 to 1, or map a quantitative field through a linear opacity scale. The two modes are mutually exclusive and may replace each other through the same action. Lines require one raw field value per series and support sampled opacity legends. Constant mode clears its field and owned opacity legend and rejects fieldType/scale or selections using that channel. Appearance encodings

encodeRadius

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeRadius(options: { value: number; target?: string }): ChartProgram;
Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
value Required number
target Optional / branch-dependent string \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeRadius({ value, target? })

Apply a constant point radius. Constant appearance

encodeTheta

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeTheta(options: ThetaEncodingOptions): ChartProgram;

Named option contracts: ThetaEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Required string
target Optional / branch-dependent string \| undefined
scale Optional / branch-dependent ThetaScaleOptions \| undefined
coordinate Optional / branch-dependent string \| undefined
aggregate Optional / branch-dependent "count" \| "sum" \| undefined
weight Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| "quantitative" \| "temporal" \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeTheta({ field, target?, fieldType?, aggregate?, weight?, scale?, coordinate? })

Encode Polar angle in clockwise degrees from 12 o’clock. Quantitative, temporal, ordinal, and nominal fields are supported for point and line marks. For arc marks, an aggregate-free quantitative field directly determines each row’s proportional sector angle. Nominal or ordinal arc fields support aggregate: "count", aggregate: "sum" plus weight, or categorical theta bands paired with radius. The default scale ID is theta and its automatic range is [0, 360]. Polar positions

encodeR

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeR(options: RadialEncodingOptions): ChartProgram;

Named option contracts: RadialEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "quantitative" \| undefined
coordinate Optional / branch-dependent string \| undefined
field Optional / branch-dependent string \| undefined
mapping Optional / branch-dependent false \| RadialMapping \| undefined
aggregate Optional / branch-dependent "count" \| "sum" \| undefined
scale Optional / branch-dependent RadiusScaleOptions \| MeasuredRadiusScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeR({ field?, aggregate?, mapping?, target?, fieldType?, scale?, coordinate? })

Encode a quantitative field as Polar radial distance. The default radius scale fits the current plot bounds and rematerializes after Canvas edits. Proportional arcs accept independent ordinary radius scales: quantitative theta uses row values, while categorical count/sum theta accepts a consistent radius per group or explicit radius count/sum. Domains use those final sector values. Mapped outer radii must exceed the inner radius. Radius aggregation requires categorical aggregated theta and stays pending until that encoding exists. Measured Arc radius accepts count/sum with mapping: "area" or "radius-length". Reassign with { field, mapping: false } to atomically replace a measured category aggregate with ordinary row-level radial length. Polar positions

encodePointRadius

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodePointRadius(options: { value: number; target?: string }): ChartProgram;
Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
value Required number
target Optional / branch-dependent string \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodePointRadius({ value, target? })

Apply a constant point glyph radius through a traced encodeRadius child. This does not assign semantic Polar radial position. Constant appearance

removePointRadius

API layer: user-facing. Authoring roles: H2, H3.

Availability: Available by v0.0.13. See release compatibility.

removePointRadius(options?: { target?: string }): ChartProgram;
Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

removePointRadius({ target? } = {})

Remove an explicit constant point glyph radius and restore the theme default. Semantic Polar radial position is unchanged. Point appearance

encodeXOffset

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeXOffset(options: XOffsetEncodingOptions): ChartProgram;

Named option contracts: XOffsetEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Required string
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| undefined
scale Optional / branch-dependent OffsetScaleOptions \| undefined
paddingInner Optional / branch-dependent number \| undefined
paddingOuter Optional / branch-dependent number \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeXOffset({
  field, target?, fieldType?, scale?, paddingInner?, paddingOuter?
})

Create or compatibly update a categorical sub-slot scale within a bar, point, or rule x category. Point/rule marks use slot centers; bars use slot bandwidth. Padding defaults to zero and is preserved on a later same-field call. Grouped bar color layout normally invokes this action automatically. Position encodings

encodeYOffset

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeYOffset(options: YOffsetEncodingOptions): ChartProgram;

Named option contracts: YOffsetEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Required string
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| undefined
scale Optional / branch-dependent OffsetScaleOptions \| undefined
paddingInner Optional / branch-dependent number \| undefined
paddingOuter Optional / branch-dependent number \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeYOffset({
  field, target?, fieldType?, scale?, paddingInner?, paddingOuter?
})

Create or compatibly update the corresponding categorical offset scale within a bar, point, or rule y category. Horizontal grouped bar color invokes this action as a wrapped child; explicit domain order, reversed range, and padding follow the same contract as encodeXOffset. Position encodings

encodeY2

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeY2(options: SecondaryPositionEncodingOptions): ChartProgram;

Named option contracts: SecondaryPositionEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
datum Optional / branch-dependent unknown
field Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| "ordinal" \| "quantitative" \| "temporal" \| undefined
target Optional / branch-dependent string \| undefined
scale Optional / branch-dependent { id?: string \| undefined; } \| { id?: string \| undefined; } \| { id?: string \| undefined; } \| undefined
coordinate Optional / branch-dependent string \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeY2({ field, target?, fieldType, scale?, coordinate? })
encodeY2({ datum, target?, fieldType?, scale?, coordinate? }) // rule

Assign an area, ranged-bar, or rect upper edge, or a rule secondary y endpoint. It requires an existing y and shares its scale and coordinate. A rule numeric datum defaults to fieldType: "quantitative" and must be finite. Rule field endpoints and nonnumeric datum endpoints require an explicit matching type. Position encodings

encodeYRange

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeYRange(options: RangePositionEncodingOptions): ChartProgram;

Named option contracts: RangePositionEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
lower Required string \| { datum: number; }
upper Required string \| { datum: number; }
target Optional / branch-dependent string \| undefined
coordinate Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "quantitative" \| "temporal" \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined
scale Optional / branch-dependent NonPointQuantitativePositionScaleOptions \| NonPointTemporalPositionScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeYRange({ lower, upper, target?, fieldType?, coordinate?, scale? })

Atomically compose area or ranged-bar encodeY and encodeY2. Area bounds accept field strings or { datum: number }, with at least one field. Final endpoints and scale are validated together. Encodings

encodeXRange

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeXRange(options: RangePositionEncodingOptions): ChartProgram;

Named option contracts: RangePositionEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
lower Required string \| { datum: number; }
upper Required string \| { datum: number; }
target Optional / branch-dependent string \| undefined
coordinate Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "quantitative" \| "temporal" \| undefined
temporalUnit Optional / branch-dependent TemporalInputUnit \| undefined
scale Optional / branch-dependent NonPointQuantitativePositionScaleOptions \| NonPointTemporalPositionScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeXRange({ lower, upper, target?, fieldType?, coordinate?, scale? })

Atomically compose area or ranged-bar encodeX and encodeX2. Area bounds accept field strings or { datum: number }, with at least one field. Encodings

encodeGroup

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeGroup(options: GroupEncodingOptions): ChartProgram;

Named option contracts: GroupEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
fieldType Optional / branch-dependent "nominal" \| undefined
field Optional / branch-dependent string \| undefined
fields Optional / branch-dependent readonly [string, ...string[]] \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeGroup({ field, target?, fieldType? })
encodeGroup({ fields: [first, ...rest], target?, fieldType? })

Split Line or ordinary Area paths by one nominal field or a non-empty unique tuple. Explicit groups alone define identity; each appearance field must have one raw value within each series. Single-element tuples normalize to the scalar field form. Without explicit Line groups, color and dash retain their shared-field grouping. Statistical and stacked-layout groups remain owned by their existing actions. Encodings

encodePathOrder

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodePathOrder(options: PathOrderEncodingOptions): ChartProgram;

Named option contracts: PathOrderEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
field Required string
fieldType Optional / branch-dependent "quantitative" \| undefined
order Optional / branch-dependent "ascending" \| "descending" \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodePathOrder({ field, target?, fieldType?, order? })

Order vertices within each compatible Cartesian line or ranged-area series. fieldType defaults to "quantitative"; order defaults to "ascending". Ties preserve source-row order, and no scale or guide is created. Series encodings

encodeParallelCoordinates

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeParallelCoordinates(options: ParallelCoordinatesEncodingOptions): ChartProgram;

Named option contracts: ParallelCoordinatesEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
coordinate Optional / branch-dependent string \| undefined
dimensions Required readonly [ParallelDimension, ParallelDimension, ...ParallelDimension[]]
key Optional / branch-dependent string \| undefined
missing Optional / branch-dependent ParallelMissingPolicy \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeParallelCoordinates({ dimensions, target?, coordinate?, key?, missing? })

Atomically assign ordered dimensions and their local scales to one line mark. The default missing policy is "break". Parallel Coordinates

removePathOrder

API layer: user-facing. Authoring roles: H2, H3.

Availability: Available by v0.0.13. See release compatibility.

removePathOrder(options?: RemovePathOrderOptions): ChartProgram;

Named option contracts: RemovePathOrderOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

removePathOrder({ target? } = {})

Remove explicit path topology and restore the mark’s automatic independent- position ordering. Series encodings

orderCategories

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

orderCategories(options: OrderCategoriesOptions): ChartProgram;

Named option contracts: OrderCategoriesOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
channel Required "theta" \| "x" \| "y"
values Optional / branch-dependent readonly CategoryValue[] \| undefined
by Optional / branch-dependent "category" \| "count" \| CategoryOrderSummary \| undefined
direction Optional / branch-dependent "ascending" \| "descending" \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

orderCategories({ target?, channel, values })
orderCategories({ target?, channel, by, direction? })

Assign explicit or computed semantic order to a nominal/ordinal Cartesian x/y or Polar theta position. Omitted explicit values and computed ties preserve source first-appearance order. The scale, connected marks, axis, and selection-item order are updated together. Category ordering

removeCategoryOrder

API layer: user-facing. Authoring roles: H2, H3.

Availability: Available by v0.0.13. See release compatibility.

removeCategoryOrder(options: RemoveCategoryOrderOptions): ChartProgram;

Named option contracts: RemoveCategoryOrderOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
channel Required "theta" \| "x" \| "y"

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

removeCategoryOrder({ target?, channel })

Remove one active category-order assignment and restore automatic first-appearance order. Category ordering

removeEncoding

API layer: user-facing. Authoring roles: H2, H3.

Availability: Available by v0.0.13. See release compatibility.

removeEncoding(options: { target?: string; channel: | "x" | "y" | "x2" | "y2" | "xOffset" | "yOffset" | "theta" | "radius" | "color" | "stroke" | "strokeDash" | "strokeWidth" | "size" | "shape" | "angle" | "group" | "opacity" | "text" | "dx" | "dy"; }): ChartProgram;
Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
channel Required "angle" \| "color" \| "dx" \| "dy" \| "group" \| "opacity" \| "radius" \| "shape" \| "size" \| "stroke" \| "strokeDash" \| "strokeWidth" \| "text" \| "theta" \| "x" \| "x2" \| "xOffset" \| "y" \| "y2" \| "yOffset"

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

removeEncoding({ target?, channel })

Remove one active semantic encoding, its generated companions, matching guide blocks, and stale concrete values. Named datasets, scales, and coordinates are retained; incomplete marks remain empty until later encoding completion. Encodings

encodeText

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeText(options: TextEncodingOptions): ChartProgram;

Named option contracts: TextEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
format Optional / branch-dependent ValueFormat \| undefined
field Optional / branch-dependent string \| undefined
value Optional / branch-dependent unknown
content Optional / branch-dependent "category" \| "share" \| "value" \| undefined
normalizeBy Optional / branch-dependent "category" \| "source" \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeText({ target?, field?, value?, format? })

Assign exactly one field, constant value, or semantic content to a text mark. format accepts "auto", .0–.12 precision with f, %, or e, or a UTC pattern composed from %Y, %m, %d, %b, %%, and literals. Reassignment replaces the previous content branch. Text marks

encodeDx

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.24. See release compatibility.

encodeDx(options: TextOffsetEncodingOptions): ChartProgram;

Named option contracts: TextOffsetEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
value Optional / branch-dependent number \| undefined
field Optional / branch-dependent string \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeDx({ target?, field })
encodeDx({ target?, value })

Move each independent Text glyph horizontally by finite signed logical pixels. Choose exactly one numeric field or constant; no scale is created. The encoding overrides the mark’s constant dx. Removing it restores that constant. Field-bound offsets participate in row grain and the Text missing-row policy. Full only; source-owned labels and other marks are rejected. Text offsets

encodeDy

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.24. See release compatibility.

encodeDy(options: TextOffsetEncodingOptions): ChartProgram;

Named option contracts: TextOffsetEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
value Optional / branch-dependent number \| undefined
field Optional / branch-dependent string \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeDy({ target?, field })
encodeDy({ target?, value })

The corresponding independent Text vertical offset; positive values move down. It preserves dx and follows the same field/constant, removal, row-grain and atomic validation rules. Set both through existing encodeChannels({target,channels}). Text offsets

encodeHistogram

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeHistogram(options: HistogramEncodingOptions): ChartProgram;

Named option contracts: HistogramEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
field Required string
target Optional / branch-dependent string \| undefined
coordinate Optional / branch-dependent string \| undefined
stack Optional / branch-dependent StackMode \| undefined
xScale Optional / branch-dependent NonPointQuantitativePositionScaleOptions \| undefined
yScale Optional / branch-dependent NonPointZeroSupportingPositionScaleOptions \| undefined
weight Optional / branch-dependent StatisticalWeight \| undefined
maxBins Optional / branch-dependent number \| undefined
binStep Optional / branch-dependent number \| undefined
binBoundaries Optional / branch-dependent readonly [number, number, ...number[]] \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeHistogram({
  field, target?, coordinate?, maxBins?, binStep?, binBoundaries?,
  stack?, xScale?, yScale?
})

Compose binned bar encodeX and count encodeY as one atomic histogram action. Choose at most one of maxBins, binStep, and binBoundaries. maxBins defaults to 10; stack defaults to "zero". Use stack: "normalize" for a unit-height partition. Encodings

Creation groupBy:false explicitly requests ungrouped Regression, Density or Horizon and survives JSON serialization. Editors preserve omission, reject explicit undefined and clear with false. Data-only transform groupBy options remain unchanged.

encodeDensity

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeDensity(options: DensityEncodingOptions): ChartProgram;

Named option contracts: DensityEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
source Optional / branch-dependent string \| undefined
field Required string
bandwidth Optional / branch-dependent number \| "auto" \| undefined
extent Optional / branch-dependent "auto" \| readonly [number, number] \| undefined
steps Optional / branch-dependent number \| undefined
kernel Optional / branch-dependent DensityKernel \| undefined
normalization Optional / branch-dependent DensityNormalization \| undefined
weight Optional / branch-dependent StatisticalWeight \| undefined
missing Optional / branch-dependent "drop" \| "error" \| undefined
as Optional / branch-dependent readonly [string, string] \| undefined
groupBy Optional / branch-dependent string \| false \| undefined
target Optional / branch-dependent string \| undefined
densityChannel Optional / branch-dependent "x" \| "y" \| undefined
coordinate Optional / branch-dependent string \| undefined
valueScale Optional / branch-dependent NonPointQuantitativePositionScaleOptions \| undefined
placement Optional / branch-dependent BaselineDensityPlacement \| CategoryDensityPlacement \| undefined
densityScale Optional / branch-dependent NonPointZeroSupportingPositionScaleOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeDensity({
  field, target?, source?, groupBy?, bandwidth?, extent?, steps?, kernel?,
  normalization?, as?, densityChannel?, coordinate?, valueScale?, densityScale?
})

Create immutable KDE data, bind it to an area mark, encode its value and density fields, and materialize baseline-closed paths. Density defaults to the y channel; kernel and normalization default to "gaussian" and "unit". Pass densityChannel: "x" for a horizontal orientation. Encodings

editDensity

API layer: user-facing. Authoring roles: H2, H3.

Availability: Available by v0.0.13. See release compatibility.

editDensity(options: EditDensityOptions): ChartProgram;

Named option contracts: EditDensityOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
source Optional / branch-dependent string \| undefined
field Optional / branch-dependent string \| undefined
groupBy Optional / branch-dependent string \| false \| undefined
bandwidth Optional / branch-dependent number \| "auto" \| undefined
extent Optional / branch-dependent "auto" \| readonly [number, number] \| undefined
steps Optional / branch-dependent number \| undefined
kernel Optional / branch-dependent DensityKernel \| undefined
normalization Optional / branch-dependent DensityNormalization \| undefined
weight Optional / branch-dependent false \| StatisticalWeight \| undefined
densityChannel Optional / branch-dependent "x" \| "y" \| undefined
valueScale Optional / branch-dependent NonPointQuantitativePositionScaleOptions \| undefined
placement Optional / branch-dependent DensityPlacement \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

editDensity({
  target?, source?, field?, groupBy?, bandwidth?, extent?, steps?, kernel?,
  normalization?, placement?
})

Create an immutable density-data revision, rebind the selected density area, and rematerialize its graphical consumers. source, field, and groupBy can revise create-time data roles; groupBy: false removes grouping. Output fields, density channel, coordinate, and position scale IDs are preserved. Encodings

encodeHorizon

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeHorizon(options?: HorizonEncodingOptions): ChartProgram;

Named option contracts: HorizonEncodingOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
source Optional / branch-dependent string \| undefined
x Optional / branch-dependent string \| HorizonXEncoding \| undefined
y Optional / branch-dependent string \| HorizonYEncoding \| undefined
groupBy Optional / branch-dependent string \| false \| undefined
bands Optional / branch-dependent number \| undefined
baseline Optional / branch-dependent number \| undefined
extent Optional / branch-dependent number \| "auto" \| undefined
resolve Optional / branch-dependent HorizonResolution \| undefined
missing Optional / branch-dependent HorizonMissingPolicy \| undefined
overflow Optional / branch-dependent HorizonOverflowPolicy \| undefined
palette Optional / branch-dependent HorizonPaletteOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeHorizon({
  target?, source?, x?, y?, groupBy?, bands?, baseline?, extent?, resolve?,
  missing?, overflow?, palette?
} = {})

Create immutable folded-band data, bind it to an area mark, and author the ordinary x, y/y2, group, and color encodings needed for a compact Horizon chart. Compatible target, source, and fields are inferred when unambiguous. Encodings

editHorizon

API layer: user-facing. Authoring roles: H2, H3.

Availability: Available by v0.0.13. See release compatibility.

editHorizon(options: EditHorizonOptions): ChartProgram;

Named option contracts: EditHorizonOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
groupBy Optional / branch-dependent string \| false \| undefined
target Optional / branch-dependent string \| undefined
source Optional / branch-dependent string \| undefined
x Optional / branch-dependent string \| HorizonXEncoding \| undefined
y Optional / branch-dependent string \| HorizonYEncoding \| undefined
bands Optional / branch-dependent number \| undefined
baseline Optional / branch-dependent number \| undefined
extent Optional / branch-dependent number \| "auto" \| undefined
resolve Optional / branch-dependent HorizonResolution \| undefined
missing Optional / branch-dependent HorizonMissingPolicy \| undefined
overflow Optional / branch-dependent HorizonOverflowPolicy \| undefined
palette Optional / branch-dependent HorizonPaletteOptions \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

editHorizon({
  target?, source?, x?, y?, groupBy?, bands?, baseline?, extent?, resolve?,
  missing?, overflow?, palette?
})

Create and bind an immutable Horizon revision, preserve omitted settings and scale identities, and rematerialize affected consumers. groupBy: false removes grouping. Encodings

encodeBarWidth

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

encodeBarWidth(options?: BarWidthOptions): ChartProgram;

Named option contracts: BarWidthOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
band Optional / branch-dependent number \| undefined
pixels Optional / branch-dependent number \| undefined
interval Optional / branch-dependent { unit: "day" \| "hour" \| "minute" \| "month" \| "quarter" \| "second" \| "year"; insetStart?: number \| undefined; insetEnd?: number \| undefined; } \| undefined

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

encodeBarWidth({ band?, pixels?, target? })

Set aggregate or ranged bar width before or after its positions are complete. Incomplete bars retain the width without creating items; histogram bins do not accept it. The modes are mutually exclusive. The first omitted mode defaults to band: 0.72; later omission retains the current mode. When every temporal bar sharing a position scale uses pixel width, bar centers use the full plot range. If any bar still uses band width, the shared scale keeps its inferred half-slot inset. An explicit numeric scale range is preserved in both cases. Switching width modes also refreshes shared marks and axis guides. Constant appearance

layoutSeries

API layer: user-facing. Authoring roles: H2.

Availability: Available by v0.0.13. See release compatibility.

layoutSeries(options: SeriesLayoutOptions): ChartProgram;

Named option contracts: SeriesLayoutOptions.

Declared options

Generated from the current TypeScript declaration. Union branches can require different combinations; optional does not mean every combination is valid.

Option Presence Type
target Optional / branch-dependent string \| undefined
mode Required ColorLayout

The following call patterns are abbreviated examples; the declaration above owns the complete option set.

layoutSeries({ target?, mode })

Assign group, stack, fill, overlay, diverging, or center placement independently of color. Full supports Bar and Area; Basic supports Bar and excludes center. Aggregate/histogram bars support all modes except center, ranged bars only overlay, and areas reject group. Ribbons support overlay only; raw accumulation requires aligned rows and a zero baseline. Stack/fill/center require nonnegative values; diverging separates signs. A zero-total fill has zero thickness and a [0,1] domain. Density retains its statistical orientation limits.

encodeGroup owns identity and source first-appearance order; color owns appearance. Reassign this action to change placement. Leaving group removes its active offset and unused automatic offset scale; user/shared scales survive. Removing color preserves identity and placement. Switch to overlay before removing a required group. Legacy color.layout, measure.stack and Bar offsets delegate to this action; the last explicit layout request wins. Color reassignment without layout preserves the stored mode. Stack aliases zero/normalize/null/ center mean stack/fill/overlay/center. Failed topology, shared-scale or guide validation preserves the previous program.

Previous reference location

This contract moved: open the current action or shared contract.

Action Reference · Chart API · Supported Features

Documentation provenance

293 actions · sha256:e755591a2e5f5e2b494867583876e28020a478c5220b77bdc6ad469a6224891d