blank
Creates invisible positioning guides. Use blank when you need to define positions for other marks (like line or ribbon) without rendering visible shapes.
A blank is a hidden rect, rect().hidden() with blank's own options: it takes part in layout, carries its datum, can be named and selected with selectAll, and feeds the color scale, but it produces no SVG element and no hover target. Like any hidden mark it keeps its shape, so as an operand of intersect, cut or another compositor it gives its box. No option makes a blank paint, and .hidden() has no effect on a blank itself: it is always hidden. Its labels show, and .hidden() hides them as it hides any mark's labels.
const locations = Object.entries(lakeLocations).map(([lake, { x, y }]) => ({
lake,
x,
y,
}));
gf.layer([
gf
.chart(locations)
.flow(gf.scatter({ by: "lake", x: "x", y: "y" }))
.mark(gf.blank().name("points")),
gf
.chart(gf.selectAll("points"))
.mark(gf.line({ stroke: "steelblue", strokeWidth: 2 })),
]).render(root, { w: 400, h: 250, axes: true });Signature
blank({ w?, h?, fill?, debug? })Parameters
An invisible sizing/positioning guide — a rect that emits no display items at all, with a restricted channel set (no x/y/cx/cy/x2/y2/theta/r — position it via a layout operator).
| Option | Type | Default | Description |
|---|---|---|---|
emX | boolean | Embed x in the parent's x space. | |
emY | boolean | Embed y in the parent's y space. | |
w | number | string | FieldExpr | Length | 0 | Width. Also percent(n), n percent of the room it is laid out in (its parent's, or the canvas), or fr(k), k shares of the room its nearest scope divides. |
h | number | string | FieldExpr | Length | 0 | Height. Also percent(n), n percent of the room it is laid out in (its parent's, or the canvas), or fr(k), k shares of the room its nearest scope divides. |
fill | string | FieldExpr | Fill color. A blank never paints; fill only seeds the shared color scale. | |
debug | boolean | Dev-only flag: logs this mark's key and datum to the console as it is built. It changes nothing about what is drawn. |
Examples
// Create invisible anchor points for a line chart
.mark(blank().name("points"))
// Blank with height encoding for area charts
.mark(blank({ h: "value" }).name("bars"))
// Log each blank's key and datum to the console (it still draws nothing)
.mark(blank({ debug: true }).name("guides"))