Mark-specific & path edits
Some edits work on a whole line or stack rather than one row. edit.line.sweep() repaints points across columns, and edit.line.anchor() builds connected paths. edit.stack.edge() and edit.stack.cut() reallocate slices in pies and stacked bars.
API reference
edit.line.sweep(options)
You-draw-it painting: a drag repaints the value of every point the pointer crosses. A move under the sweep driver, so it inverts the pointer through the same scale.
edit.line.sweep({ guide, when, stage }) → Edit| Option | Type · default | Description |
|---|---|---|
guide | booleandefaulttrue | Draw tracking indicators along the swept column. |
mode | 'absolute'default'absolute' | A sweep paints the pointer's position, so 'relative' has no meaning here and warns. |
An Edit scoped to line. It needs a mark that groups points into series.
edit.line.draw(options)
Freehand path sampling, or a you-draw-it upsert on a line mark.
edit.line.draw({ along, value, samples, minDist, series, threshold, into }) → Edit| Option | Type · default | Description |
|---|---|---|
along / value | 'x' | default'x' / 'y' | The independent axis to draw along, and the dependent value axis. |
samples | number | defaultthe scale's ticks | Domain grid points the drawn value snaps to: a count, explicit positions, or a time interval. |
minDist | numberdefault8 | How far the pointer must travel, in px, before another freehand point is sampled. |
series | stringdefaultthe mark's series field | The column that carries the series key. Override it when the drawn line groups by something other than the mark's own grouping channel. |
into | 'nearest' | default'nearest' | Append to the nearest line, or start a fresh series. |
edit.line.anchor(options)
Click to add anchor points to a line, one at a time.
edit.line.anchor({ into, series, gesture, when }) → Edit| Option | Type · default | Description |
|---|---|---|
into | 'nearest' | default'nearest' | Add the point to the closest existing series, or start a new one. A click in empty space under 'nearest' also starts a fresh series. |
series | stringdefaultthe mark's series field | The column the new point's series key is written to. |
edit.line.newSeries(options)
Seed a whole line at once — one anchor per sampled domain position, all at the pointer’s value. The draw-from-scratch primitive; pair it with sweep to shape the flat line it leaves.
edit.line.newSeries({ along, value, samples, series }) → Edit| Option | Type · default | Description |
|---|---|---|
along / value | 'x' | default'x' / 'y' | The axis the line runs along, and the axis it carries a value on. |
samples | number | defaultthe scale's ticks | Where the anchors go: a count, explicit domain positions, or a time interval. |
series | stringdefaultthe mark's series field | The column the new series key is written to. |
edit.line.removeSeries(options)
Delete a whole line. Clicking any point on it reads that point’s series key and drops every row sharing it — the counterpart to remove, which drops one anchor.
edit.line.removeSeries({ series, gesture, when }) → Edit| Option | Type · default | Description |
|---|---|---|
series | stringdefaultthe mark's series field | The column that identifies the line. |
gesture / when | string / (ctx) => default'click' / — | Pair them with a when if another click edit shares the mark — removing one point against removing the whole line. |
edit.line.moveSeries(options)
Drag a whole line. Press on a line, or inside a closed one, and every row of that series moves by the pointer’s travel. Each vertex stays inside its field’s domain. A press away from every line is left to the mark’s other edits, so it sits beside move on the handles and a draw with when: when.far.
edit.line.moveSeries({ channels, threshold, when }) → Edit| Option | Type · default | Description |
|---|---|---|
channels | string[]default['x', | The positional channels moved. |
threshold | numberdefault6 | How near an open line counts as on it, in px. A closed line is also grabbed anywhere inside. |
edit.stack.cut(options)
Click inside a stacked segment to divide it into two. The new segment's category goes in the mark's `stack` field, taken from its schema domain; a mark with no `stack` channel refuses the cut and logs a warning.
edit.stack.cut({ label, defaults, when }) → Edit| Option | Type · default | Description |
|---|---|---|
label | string | The placeholder name a new segment takes on an open domain, which has no next category to hand out. |
defaults | objectdefault{} | Extra fields to seed the new row with, over the schema's defaults. |
edit.stack.edge(options)
Drag a boundary to move value between the two segments it separates. Only those two change — one grows by exactly what the other loses — so the group’s total is preserved by construction.
edit.stack.edge(options?) → Edit| Option | Type | Description |
|---|---|---|
— | EditOptions | The universal edit options. The boundary it drags is resolved from the mark's own layout. |
edit.stack.merge(options)
Double-click a boundary to fuse the two segments it separates back into one. The inverse of cut, preserving the same total: the lower row survives and takes the pair’s whole magnitude.
edit.stack.merge(options?) → Edit| Option | Type | Description |
|---|---|---|
— | EditOptions | The universal edit options. It removes a row, not a category, so the domain is left alone and cutting brings that category back. |
Line sweep (you-draw-it)
edit.line.sweep() sets each point's value as the pointer crosses its column. The x positions stay fixed and the curve follows the drag. It is shorthand for move({ pick: "sweep", guide: true }) on a line, the form the first two examples use.
Sweep to shape a curve
edit: move({ pick: "sweep" }) on the y channel paints values as you drag horizontally.
const chart = Elicit({width: 420, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 0, y: 50 }, { x: 1, y: 50 }, { x: 2, y: 50 }, { x: 3, y: 50 },{ x: 4, y: 50 }, { x: 5, y: 50 }, { x: 6, y: 50 }, { x: 7, y: 50 },],schema: {x: { type: "quantitative", domain: [0, 7] },y: { type: "quantitative", domain: [0, 100] },},marks: [lineY({stroke: "#50AEB7", strokeWidth: 3, curve: "catmullRom",channels: {x: { field: "x" },y: { field: "y",edit: move({ pick: "sweep", guide: true }) },},}),],});mount(chart.dom());
Series-scoped multi-line sweeps
When several lines share a plot, a sweep locks onto the nearest line when the drag starts and paints only that series. The other series stay as they are.
Two lines swept independently
The sweep locks onto the closest series at the start of the drag.
const chart = Elicit({width: 420, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ g: "plan", x: 0, y: 30 }, { g: "plan", x: 1, y: 45 }, { g: "plan", x: 2, y: 40 }, { g: "plan", x: 3, y: 60 },{ g: "actual", x: 0, y: 70 }, { g: "actual", x: 1, y: 62 }, { g: "actual", x: 2, y: 75 }, { g: "actual", x: 3, y: 68 },],schema: {x: { type: "quantitative", domain: [0, 3] },y: { type: "quantitative", domain: [0, 100] },g: { type: "categorical" }, // a group identifier, not an ordered scale},marks: [lineY({strokeWidth: 3, curve: "catmullRom",channels: {x: { field: "x" },y: { field: "y",edit: move({ pick: "sweep", guide: true }) },stroke: { field: "g" },},}),],});mount(chart.dom());
Sweeping a band
Put edit.line.sweep() on both edges of an areaY band, y1 and y2. A sweep locks onto the edge whose handle is nearest where the drag starts, and paints that edge alone. The other edge stays where it is. Dragging a single handle still moves just that point.
Place the sweep on the channel it paints. A mark-level edits: [edit.line.sweep()] names no channel, so it has nothing to write, and the chart warns. A sweep targets the mark's handles, so handles: false leaves it nothing to aim at (it warns too). Use handles: 'hit' to hide the handles and keep them targetable.
Sweep an uncertainty band
edit.line.sweep() on y1 and y2 — each sweep paints one edge; ordering keeps lo ≤ hi.
const chart = Elicit({width: 420, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 0, lo: 40, hi: 60 }, { x: 1, lo: 38, hi: 62 }, { x: 2, lo: 35, hi: 66 },],schema: {x: { type: "quantitative", domain: [0, 7] },lo: { type: "quantitative", domain: [0, 100] },hi: { type: "quantitative", domain: [0, 100] },},constraints: [ ordering({ field: ["lo", "hi"] }) ],marks: [areaY({fill: "#2B5D87", curve: "catmullRom",channels: {x: { field: "x" },// One sweep per edge: a drag paints the edge nearest where it starts.y1: { field: "lo", edit: edit.line.sweep() },y2: { field: "hi", edit: edit.line.sweep() },},}),],});mount(chart.dom());
Line anchors & freehand paths
edit.line.anchor() adds a point to the nearest line, or starts a new series in empty space. edit.line.draw() samples the pointer as you drag to record a freehand stroke.
Click to add an anchor
Clicking empty space appends the next anchor point to the line.
const chart = Elicit({width: 380, height: 220,margins: { top: 16, right: 16, bottom: 28, left: 34 },data: [{ step: 1, val: 20 },],schema: {step: { type: "quantitative", domain: [1, 6] },val: { type: "quantitative", domain: [0, 100] },},marks: [line({stroke: "#50AEB7",channels: {x: { field: "step" },y: { field: "val", edit: move() },},edits: [edit.line.anchor({ into: "nearest" }),],}),],});mount(chart.dom());
Arc slices & stacked bars
On a partition (a pie arc, a donut or a stacked barY), edit.stack.edge() and edit.stack.cut() change the proportions and keep the total constant.
edit.stack.edge() lets you drag the seams between segments. With edit.stack.cut(), click inside a segment to split it there. The new piece takes an unused category from the domain of the mark's stack field.
Cut a stack into categories
Click inside a 100% bar to cut it into categories; drag seams to adjust proportions.
const chart = Elicit({width: 380, height: 220,margins: { top: 16, right: 16, bottom: 28, left: 40 },data: [{ year: "2024", share: 100, asset: "Stocks" },],schema: {year: { type: "categorical", domain: ["2024"] },asset: { type: "categorical", domain: ["Stocks", "Bonds", "Cash", "Real Estate"] },share: { type: "quantitative", domain: [0, 100] },},marks: [barY({channels: {x: { field: "year" },y: { field: "share" },stack: { field: "asset" },fill: { field: "asset" },},edits: [edit.stack.cut(),edit.stack.edge(),],}),],});mount(chart.dom());
Pie slice boundary redistribution
edit.stack.edge() on a pie mark redistributes adjacent shares.
const chart = Elicit({width: 300, height: 260,margins: { top: 20, right: 20, bottom: 20, left: 20 },axes: false,data: [{ cat: "A", val: 50 },],schema: {cat: { type: "categorical" },val: { type: "quantitative", domain: [0, 100] },},marks: [arc({outerRadius: 95,edits: [edit.stack.edge()],channels: {theta: { field: "val" },fill: { field: "cat" },},}),],});mount(chart.dom());