Charts, Data, and Composition Actions

These are direct immutable ChartProgram actions. Each accepts one option object and returns a new program.

createCanvas

createCanvas({ width?, height?, background?, margin? })

Create the program’s Canvas and plot bounds. Canvas options

editCanvas

editCanvas({ width?, height?, background?, margin? })

Edit Canvas properties and rematerialize connected consumers. Canvas options

editCompositionLayout

editCompositionLayout({ columns?, gap?, align?, padding? })

Edit spacing, cross-axis alignment, or outer padding on an existing composition. columns changes wrapping only on a facet composition and is rejected for concat. Omitted values are preserved, child identity is unchanged, and the parent snapshot is rebuilt from retained child programs.

replaceCompositionChild

replaceCompositionChild({ target, program })

Replace one named child while preserving its slot ID and order. The replacement must already be a complete chart or composition program.

facet

facet({ id?, field, data?, columns?, gap?, align?, padding?, scales?, guides? })

Repeat one complete chart by a field on its common row-preserving dataset ancestor. Values preserve source first appearance; scale policies can be "shared" or "independent" by supported channel, and layered regression data and other supported statistical descendants are recomputed per cell. guides: { axes: "outer" } keeps axes only on occupied outer cells, while guides: { legend: "shared" } promotes one compatible parent-owned legend at the child legend’s configured left, right, top, or bottom edge. Top and bottom promotion also preserves the child legend’s horizontal alignment; author those options with createLegend before calling facet. See Program composition.

editFacetHeaders

editFacetHeaders({ fontSize?, fontFamily?, fontWeight?, color?, offset? })

Edit the parent-owned repeated facet headers and rebuild the parent snapshot without changing child programs or facet value order.

editFacetScales

editFacetScales({ x?, y?, xOffset?, yOffset?, color?, size?, shape?, opacity?, strokeDash? })

Partially change used facet channels between "shared" and "independent". Every cell is rederived from the retained pre-facet program while field, data, value order, child IDs, layout, guides, headers, and title are preserved.

editFacetGuides

editFacetGuides({ axes?, legend? })

Partially change axes between "each" and "outer", or legend ownership between false and "shared". Shared legend promotion requires concretely compatible child scales and guide recipes.

createData

createData({ id?, values })

Create one immutable named dataset. Data

createScatterPlot

createScatterPlot({ id?, data?, coordinate?, x, y, color?, size?, shape?, point?, guides? })

Create a complete Cartesian point chart from required x/y fields and optional appearance encodings. Basic Charts

createLinePlot

createLinePlot({ id?, data?, coordinate?, x, y, color?, groupBy?, strokeDash?, line?, guides? })

Create a complete Cartesian line chart, including optional series grouping and appearance. Basic Charts

createBarPlot

createBarPlot({ id?, data?, coordinate?, x, y, color?, width?, bar?, guides? })

Create a complete vertical, horizontal, aggregate, ranged, grouped, or stacked bar chart through the existing bar policies. Basic Charts

createHistogram

createHistogram({ id?, data?, coordinate?, field, maxBins?, binStep?, binBoundaries?, stack?, xScale?, yScale?, color?, bar?, guides? })

Create a bar layer with atomic bin and count encodings. Exactly one bin mode may be specified. Basic Charts

createHeatmap

createHeatmap({ id?, data?, coordinate?, x, y, bin?, color?, rect?, guides? })

Create one rect cell per valid pre-gridded row, or bin raw quantitative x/y rows into ranged cells colored by count. Basic Charts

createParallelCoordinates

createParallelCoordinates({ id?, data?, coordinate?, dimensions, key?, missing?, color?, strokeDash?, line?, guides? })

Create one open line path per source row across an ordered list of dimension- local scales and axes. Only dimensions is required. Parallel Coordinates

filterData

filterData({ id, source?, field, oneOf | predicate | range })

Create an immutable named derived dataset using exactly one membership, comparison, or range filter. The source defaults to current data. Data

filterMarks

filterMarks({ target?, grain?, field | channel | property, op, ...operands })

Retain matching final mark items through the shared selector grammar, create one namespaced immutable member-row dataset, rebind the mark, and rematerialize its scales and connected guides without changing the source. Data

highlightMarks

highlightMarks({
  id?, target?, select?, selection?, color?, opacity?, fill?, stroke?,
  strokeWidth?, strokeDash?, shape?, size?, offset?, dimOthers?, bringToFront?
})

Select point, bar, line, area, arc, or rule items inline or reuse a stored selection, then apply mark-specific concrete emphasis, optional complement dimming, and selected-last order. Mark selection and highlighting

removeMarkHighlight

removeMarkHighlight({ selection? } = {})

Remove one highlight assignment, restore the target mark and categorical legend baseline, and retain the reusable selection. Selection lifecycle

createRegressionData

createRegressionData({
  id, source?, x, y, groupBy?, method?, degree?, span?, confidence?, interval?
})

Create immutable linear, polynomial, or LOESS fitted rows at observed unique x values. Linear and polynomial fits support Student-t mean or prediction bounds; LOESS is line-only. Data

createDensityData

createDensityData({
  id, source?, field, groupBy?, bandwidth?, extent?, steps?,
  kernel?, normalization?, as?
})

Create immutable KDE rows on one shared inclusive sample grid. Source defaults to current data, steps to 100, bandwidth to an automatic Scott-rule estimate, kernel to "gaussian", and normalization to "unit". Data

createTimeUnitData

createTimeUnitData({ id, source?, field, unit, as })

Create an immutable row-preserving dataset with one UTC year, quarter, month, day, hour, minute, or second bucket-start timestamp field. Time-unit data transforms

createWindowData

createWindowData({ id, source?, partitionBy?, sortBy?, operations })

Create an immutable derived dataset by applying ordered row-number, rank, dense-rank, cumulative-sum, lag, lead, moving-mean, or moving-sum operations within optional partitions. Moving frames include the current sorted row, require a non-negative preceding, default following to 0, and truncate at partition edges. The calculation follows a stable sort while the output preserves source row order. Window data transforms

createBin2DData

createBin2DData({
  id, source?, x, y, bins?, extent?, includeEmpty?, members?, as?
})

Aggregate finite x/y pairs into deterministic rectangular cell bounds and counts. Reusing the logical ID creates an immutable revision and rematerializes direct visual consumers. Rectangular 2D bins

editBin2DData

editBin2DData({
  target?, source?, x?, y?, bins?, extent?, includeEmpty?, members?, as?
})

Partially revise the current or unique logical 2D-bin owner. Omitted top-level transform options are preserved; successful edits create an immutable revision, rebind direct visual consumers, and safely release the prior revision. Rectangular 2D bins

Action Reference · Chart API · Supported Features