Point
point draws one dot per row at x/y, for scatter plots and creatable points. size, fill, stroke and angle are channels like any other. The default shape is a circle; shape: 'square' draws a centred square of side 2 × size that rotates about its centre.
API reference
point(options)
Import plot from elicitjs. A circle or square per datum; every channel — positional or not — resolves through the global scales.
point({ channels, shape, edits, id }) → Mark| Option | Type · default | Description |
|---|---|---|
channels | objectdefault{} | Channel map — see Channels. |
image | string | | The shape's background image: a URL painted inside each shape in place of the fill. Takes fit, position and repeat as channel params, as in CSS. See Image. |
shape | 'circle' | default'circle' | Glyph shape. A square is a centred rect with side 2 × size, so an angle channel can spin it. |
edits | Edit[] | Mark-level edits; per-channel edits live in the channels map. |
tip | true | | A tooltip of the row under the pointer, as on every mark: all columns, the listed ones, or your own text. See Tooltips. |
motion | booleandefaultfalse | Eased drawing, as on every mark. When the rows change, the mark's shapes travel to their new places. A grabbed row is drawn at the pointer along a channel whose scale is a band or a point scale, and eases into its slot on release. The data is never eased. See Ranking. |
fill, | styledefaultfill: 'steelblue' | Shorthands / channels. |
| Channel | Type | Description |
|---|---|---|
x | linear | | Horizontal position; omitted parks the dot at the centre of x. |
y | linear | | Vertical position; omitted parks the dot at the centre of y. |
size | linear | The circle radius / half square side (default 5). Pair with edit: resize() to drag the radius. |
angle | linear | Orientation in math degrees (0° = +x, CCW). Pair with edit: rotate({ pivot: 'mark', fold: false, pick: 'direct' }). Circles are rotation-invariant; squares and symbols rotate. |
fill | const | | Fill; a field tints through the ordinal palette. |
stroke, | const | | Standard style surface. |
symbol | const | | Draws the point as a glyph (emoji or unicode shape), drawn as text and sized by size. An SVG path warns; use plot.shape() for path shapes. |
A mark emitting one circle or rect per datum.
Channels: size, fill, colour
A numeric field can drive the radius (size) and a continuous colour ramp at once. A categorical field drives the ordinal palette. Constants and fields mix on the same mark.
A symbol channel draws each point as a glyph, an emoji or a unicode shape, sized by size; see Symbol. point draws a symbol as text, so an SVG path string as a symbol logs a warning. For path shapes, use plot.shape().
tip: true shows a tooltip of the row under the pointer, on point and every other mark. Drags work through it. See Tooltips.
Sequential fill + size from a number
A numeric field drives both the continuous colour ramp and the radius.
const chart = Elicit({width: 340, height: 240,margins: { top: 14, right: 14, bottom: 26, left: 34 },data: [{ h: 150, weight: 48 }, { h: 160, weight: 57 }, { h: 170, weight: 66 },{ h: 180, weight: 78 }, { h: 190, weight: 92 }, { h: 165, weight: 61 },],schema: {h: { type: "quantitative", domain: [140, 200] },weight: { type: "quantitative", domain: [40, 100] },},marks: [point({channels: {x: { field: "h" },y: { field: "weight" },fill: { field: "weight" }, // number -> sequential rampsize: { field: "weight" }, // number -> radius},}),],});mount(chart.dom());
Constant style shorthands
Outlined, semi-transparent dots via top-level stroke / strokeWidth / opacity.
const chart = Elicit({width: 340, height: 240,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 12, y: 40 }, { x: 30, y: 22 }, { x: 48, y: 55 },{ x: 66, y: 33 }, { x: 80, y: 68 }, { x: 22, y: 60 },],schema: {x: { type: "quantitative", domain: [0, 100] },y: { type: "quantitative", domain: [0, 80] },},marks: [point({fill: "#F2B94B", opacity: 0.85,size: 9,channels: {x: { field: "x" },y: { field: "y" },},}),],});mount(chart.dom());
Heatmap of circles / squares
Put a category on both x and y and each dot centres at that intersection, giving a grid heatmap. fill encodes the value as colour and size as radius, so magnitude reads twice. shape: 'square' swaps circles for centred squares. Use rect for filled cells that tile the plane. The size scale is invertible, so resize() on it drags a dot's radius back to a value, and its colour re-derives from the same field.
Sized, coloured grid
Category on x and y; size and fill both ramp off the value field.
const chart = Elicit({width: 420, height: 260,margins: { top: 16, right: 84, bottom: 30, left: 56 },data: [{ day: "Mon", slot: "AM", load: 4 }, { day: "Mon", slot: "PM", load: 9 }, { day: "Mon", slot: "Eve", load: 6 },],schema: {day: { type: "categorical", domain: ["Mon", "Tue", "Wed", "Thu"] },slot: { type: "categorical", domain: ["AM", "PM", "Eve"] },load: { type: "quantitative", domain: [0, 20] },},marks: [// A category on both axes centres one dot per (day, slot). `size` ramps the// radius and `fill` the colour off the same field, so magnitude reads twice.// `size` is invertible, so resize() drags a dot's radius back to a value —// its colour re-derives from the same field on the next render.point({channels: {x: { field: "day" },y: { field: "slot" },size: { field: "load", edit: edit.resize() },fill: { field: "load" },},}),legendColor({ anchor: "right", title: "load" }),],});mount(chart.dom());
Moving points in 2D
When both x and y carry a drag, the pointer inverts through both positional scales.
2D move (scatter)
Both x and y carry edit: move(), so a dot moves anywhere.
const chart = Elicit({width: 380, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 20, y: 30 }, { x: 50, y: 62 }, { x: 78, y: 40 }],schema: {x: { type: "quantitative", domain: [0, 100] },y: { type: "quantitative", domain: [0, 100] },},marks: [point({fill: "#50AEB7", opacity: 0.85,size: 9,channels: {x: { field: "x" },y: { field: "y" },},edits: [ move({ channels: ["x", "y"] }) ],}),],});mount(chart.dom());
Adding points
create() on a point inverts the pointer through the x and y scales to mint a datum. A move-drag is on the same mark here, so the creator uses gesture: "dblclick" to keep the two gestures apart. See Create · Remove · Anchors for the full model and which marks can create.
Double-click to add a point
create({ gesture: "dblclick" }) mints a datum at the pointer; group comes from the schema default; count({ max }) caps the dataset.
const chart = Elicit({width: 380, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 25, y: 40, group: "a" },{ x: 60, y: 70, group: "a" },],schema: {x: { type: "quantitative", domain: [0, 100] },y: { type: "quantitative", domain: [0, 100] },group: { type: "categorical", default: "a" },},constraints: [ count({ max: 10 }) ],marks: [point({fill: "#1B3F60",size: 8,channels: {x: { field: "x", edit: move() },y: { field: "y", edit: move() },},// dblclick, not click: a plain click would race the move-drag on the same// mark. The pointer inverts through x and y to mint the datum; group comes// from the schema default. count caps the dataset.edits: [ create({ gesture: "dblclick" }) ],}),],});mount(chart.dom());
Rotating squares and ticks
An angle channel orients a mark about its centre. Degrees follow the math convention (0° = +x, counter-clockwise). rotate() inverts the pointer through the same scale. Squares use point({ shape: 'square' }). Short tickX / tickY segments (with length) rotate the same way, as directional markers on a scatter.
Picking follows the rotation: a proximity pick measures a tick where it is drawn, and hover and selection outlines turn with the mark.
Scatter of rotatable squares
shape: 'square' plus angle with rotate({ pivot: 'mark', fold: false, pick: 'direct' }).
const chart = Elicit({width: 380, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 20, y: 30, theta: -20 },],schema: {x: { type: "quantitative", domain: [0, 100] },y: { type: "quantitative", domain: [0, 100] },theta: { type: "quantitative", domain: [-180, 180] },},marks: [point({shape: "square",fill: "#50AEB7", size: 10,channels: {x: { field: "x" },y: { field: "y" },angle: {field: "theta",scale: { range: [-180, 180] },edit: rotate({ pivot: "mark", fold: false, pick: "direct" }),},},}),],});mount(chart.dom());
Scatter of rotatable ticks
tickX with length centres a short vertical segment on (x, y); angle rotates it about that midpoint — a lean / direction marker.
const chart = Elicit({width: 380, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 20, y: 30, theta: -20 },],schema: {x: { type: "quantitative", domain: [0, 100] },y: { type: "quantitative", domain: [0, 100] },theta: { type: "quantitative", domain: [-180, 180] },},marks: [tickX({length: 36,stroke: "#50AEB7",strokeWidth: 4,channels: {x: { field: "x" },y: { field: "y" },angle: {field: "theta",scale: { range: [-180, 180] },edit: rotate({ pivot: "mark", fold: false, pick: "direct" }),},},}),],});mount(chart.dom());
Grabbing a spun tick from nearby
pick: 'nearest' with a 12px threshold. The catchment tracks each tick's drawn arm, so the flat one is grabbable along the horizontal.
const chart = Elicit({width: 380, height: 260,margins: { top: 14, right: 14, bottom: 26, left: 30 },data: [{ x: 22, y: 32, theta: 90 },{ x: 74, y: 68, theta: 20 },],schema: {x: { type: "quantitative", domain: [0, 100] },y: { type: "quantitative", domain: [0, 100] },theta: { type: "quantitative", domain: [-180, 180] },},marks: [tickX({length: 36,stroke: "#50AEB7",strokeWidth: 4,channels: {x: { field: "x" },// A 4px tick is a small target, so pick the nearest one within 12px// instead of demanding a hit. The catchment is measured against the tick// as DRAWN — along the arm it currently points down, not the vertical it// would occupy at 0° — so the left tick (spun flat) is grabbable off// either END, nowhere near the upright segment it started as.y: {field: "y",edit: move({channels: ["y"],pick: "nearest",threshold: 12,guide: { catchment: true },}),},angle: { field: "theta", scale: { range: [-180, 180] } },},}),],});mount(chart.dom());