A mark's fill is its color. fillPattern says how that color is laid down: as a solid, or as a lattice of small cells, each holding one square, dot, symbol, or pictogram. The common use is projected data: the same color as the series it continues, drawn as a grid of cells so it reads as not yet final.
Two things set it apart from a repeating texture. A cell is drawn whole or not at all, so no cell is ever cut by the edge of its mark. And it works on every shape (bars, areas, wedges, network nodes, map regions, physics bodies), on canvas and in server-rendered SVG, from one declaration.
Projected bars
Add fillPattern in a style rule. The rule does not restate a color: the bar keeps the color it already had. A dashed outline is the usual companion, and strokeDasharray now applies to bar, area, wedge, point, and node outlines.
Measured months solid, projected months as a grid
import { BarChart } from "semiotic" const frameProps = { /* --- Data --- */ data: monthlyBars, /* --- Size --- */ height: 300, /* --- Layout --- */ barPadding: 40, /* --- Process --- */ valueAccessor: "value", categoryAccessor: "month", /* --- Customize --- */ color: "#3366ff", /* --- Other --- */ styleRules: [{ when: { field: "projected", eq: true }, style: { fillPattern: "grid", stroke: "#3366ff", strokeDasharray: "4 3" } }] } export default () => { return <BarChart {...frameProps} /> }
A month that is partly in is two stacked pieces: what has been measured, and the projected remainder on top.
Actual so far, with the projected remainder stacked on top
import { StackedBarChart } from "semiotic" const frameProps = { /* --- Data --- */ data: stackedBars, /* --- Size --- */ height: 300, /* --- Layout --- */ barPadding: 60, stackBy: "part", /* --- Process --- */ valueAccessor: "value", categoryAccessor: "month", /* --- Customize --- */ colorScheme: { Actual: "#3366ff", Projected: "#3366ff" }, showLegend: false, /* --- Other --- */ styleRules: [{ when: { field: "part", eq: "Projected" }, style: { fillPattern: "grid", stroke: "#3366ff", strokeDasharray: "4 3" } }] } export default () => { return <StackedBarChart {...frameProps} /> }
Splitting a series at "now"
A line or area is one mark per series, so a rule cannot pick out part of it the way it picks out one bar. An x-axis threshold names a position along the series instead. OnAreaChart and StackedAreaChart, a rule such as{ axis: "x", gte: now } splits every series at that x, and each part takes the style the rules give it.
A line until now, a projection drawn as a grid after
import { AreaChart } from "semiotic" const frameProps = { /* --- Data --- */ data: signups, /* --- Size --- */ height: 320, /* --- Process --- */ xAccessor: "month", yAccessor: "value", yExtent: [0,70], /* --- Customize --- */ curve: "monotoneX", color: "#3366ff", /* --- Annotate --- */ annotations: [{ type: "x-threshold", month: 8, label: "Now", color: "#161616" }], /* --- Other --- */ styleRules: [{ when: { axis: "x", lt: 8 }, style: { fillOpacity: 0 } }, { when: { axis: "x", gte: 8 }, style: { fillPattern: "grid", strokeDasharray: "4 3" } }] } export default () => { return <AreaChart {...frameProps} /> }
The split happens after the areas are stacked, so the stack is exactly the one you would get without the rule. backgroundOpacity adds a faint tint of the series color under the cells, which helps a stack read as continuous bands.
Each stacked series: solid before now, a grid after
import { StackedAreaChart } from "semiotic" const frameProps = { /* --- Data --- */ data: stackedSeries, /* --- Size --- */ height: 340, /* --- Layout --- */ areaBy: "region", /* --- Process --- */ xAccessor: "month", yAccessor: "value", /* --- Customize --- */ colorBy: "region", colorScheme: { East: "#3366ff", West: "#255f7d" }, areaOpacity: 1, curve: "linear", /* --- Annotate --- */ annotations: [{ type: "x-threshold", month: 8, label: "Now", color: "#161616" }], /* --- Other --- */ styleRules: [{ when: { axis: "x", gte: 8 }, style: { fillPattern: { backgroundOpacity: 0.08 }, strokeDasharray: "6 4" } }] } export default () => { return <StackedAreaChart {...frameProps} /> }
On a time axis the threshold is epoch milliseconds: gte: now.getTime(). Only declarative x thresholds (gt, gte, lt,lte, within, outside) split a series. A predicate function still styles a series as a whole.
The descriptor
"grid" is whole 3 px squares on a 4 px pitch. "pulse"is the same grid shaded from full strength at the bottom to faint at the top, and pulsing. Pass an object to change anything about either. Every field but a cellfunction is optional and JSON-safe, so a pattern survives a serialized config and a server render.
TS
fillPattern?: "grid" | "pulse" | "none" | FillPattern interface FillPattern { cell?: "square" | "dot" | SymbolName | GlyphDef | CellRecipe // default "square" pitch?: number | [number, number] // cell size in px (default 4) size?: number // the cell mark's size in px (default 3) scale?: number // multiplies pitch and size (default 1) color?: string // default: the mark's own fill opacity?: number | { // of the cells, or a shade across the mark; from: number // fillOpacity does not dim them to: number direction?: Direction // default "up" } background?: string // tint color under the cells (default: the mark's fill) backgroundOpacity?: number // tint opacity, 0–1 (default 0: no tint) density?: number | { // share of cells kept, or a ramp across the mark from: number to: number direction?: Direction order?: "ordered" | "random" edge?: boolean // keep the whole row where the ramp ends } fit?: "whole" | "center" // default "whole" anchor?: Anchor | [Anchor, Anchor] // where the lattice starts; a pair sets x and y apart padding?: number // min gap to the mark's edge snap?: boolean // whole-pixel size and pitch on canvas (default true) motion?: boolean | { // the cells pulse on canvas period?: number // ms per pulse (default 1600) amount?: number // how far they fade, 0–1 (default 0.5); 0 hands the clock to a cell recipe } } type Anchor = "auto" | "mark" | "plot" type Direction = "up" | "down" | "left" | "right" | "outward" | "inward"
"none" switches off a pattern set by an earlier rule, following the usual last-rule-wins cascade. scale keeps the proportions of a pattern while changing its grain: the three bars below are the same pattern at 1×, 2×, and 4×.
One pattern at three scales
import { BarChart } from "semiotic" const frameProps = { /* --- Data --- */ data: [{ grain: "1×", value: 60, scale: 1 }, { grain: "2×", value: 60, scale: 2 }, ... ], /* --- Size --- */ height: 260, /* --- Layout --- */ barPadding: 50, /* --- Process --- */ valueAccessor: "value", categoryAccessor: "grain", /* --- Customize --- */ color: "#3366ff", /* --- Other --- */ styleRules: [{ style: (d58) => ({ fillPattern: { scale: d58.scale } }) }] } export default () => { return <BarChart {...frameProps} /> }
Shade, pulse, and edges
opacity as a ramp shades the cells across the mark, in tenths so a canvas and an SVG draw the same steps. motion makes the whole grid pulse on canvas; it draws the grid at rest in static SVG and server renders, under reduced motion, while the chart is paused and in a hidden tab. "pulse" is both together, and it is the look the pending data state draws by default.density.edge keeps the row a density ramp ends on, so a column that thins toward its top still shows its height, and anchor: ["mark", "plot"] centers columns of cells in each bar while every bar shares the same rows.
A plain grid, a shaded one, the pulse preset, and a thinning column on shared rows
import { BarChart } from "semiotic" const frameProps = { /* --- Data --- */ data: [{ kind: "grid", value: 52, pattern: "grid" }, { kind: "shade", value: 60, pattern: { opacity: { from: 1, to: 0.3, direction: "up" } } }, ... ], /* --- Size --- */ height: 260, /* --- Layout --- */ barPadding: 40, /* --- Process --- */ valueAccessor: "value", categoryAccessor: "kind", /* --- Customize --- */ color: "#3366ff", /* --- Other --- */ styleRules: [{ style: (d58) => ({ fillPattern: d58.pattern }) }] } export default () => { return <BarChart {...frameProps} /> }
A cell function draws each cell however you like, and with motionset it receives the chart's clock as time. Setmotion: { amount: 0 } to switch off the built-in pulse and animate the cells yourself. Keep the function and the pattern object stable between renders (a module constant or a memo), since a new function starts a new layout.
JSX
// A wave that sweeps across the cells, left to right, every two seconds. const sweep = { motion: { amount: 0 }, cell: ({ u, time }) => ({ opacity: 0.35 + 0.65 * (0.5 + 0.5 * Math.cos(2 * Math.PI * (u - time / 2000))) }), } <BarChart data={data} styleRules={[{ style: { fillPattern: sweep } }]} ... />
A tint under the cells
backgroundOpacity fills the mark under its cells with the mark's own color, so the whole shape reads as a light version of its series and the cells sit on top.{ backgroundOpacity: 0.25 } is a quarter-strength fill. The tint is the mark's fill, which is also the cells' color, so every series is tinted with its own. When color recolors the cells, the tint keeps the mark's color; setbackground to tint with a different one.
Cells alone, over a 25% tint, and recolored over the same tint
import { BarChart } from "semiotic" const frameProps = { /* --- Data --- */ data: [{ look: "Cells", value: 60, pattern: { scale: 2 } }, { look: "Cells + 25% tint", value: 60, pattern: { scale: 2, backgroundOpacity: 0.25 } }, ... ], /* --- Size --- */ height: 260, /* --- Layout --- */ barPadding: 50, /* --- Process --- */ valueAccessor: "value", categoryAccessor: "look", /* --- Customize --- */ color: "#3366ff", /* --- Other --- */ styleRules: [{ style: (d58) => ({ fillPattern: d58.pattern }) }] } export default () => { return <BarChart {...frameProps} /> }
Each slice tinted with its own color
import { DonutChart } from "semiotic" const frameProps = { /* --- Data --- */ data: forecastSlices, /* --- Size --- */ height: 320, /* --- Process --- */ valueAccessor: "value", categoryAccessor: "category", /* --- Customize --- */ colorScheme: { Booked: "#3366ff", Committed: "#255f7d", Forecast: "#b5446e" }, /* --- Other --- */ styleRules: [{ style: { fillPattern: { pitch: 6, size: 4, backgroundOpacity: 0.25 } } }] } export default () => { return <DonutChart {...frameProps} /> }
Coverage that thins
density keeps a share of the cells. Give it a ramp and coverage thins across the mark: here it starts full at "now" and falls to a fifth by the end of the projection, so the further out the estimate, the less ink it gets. "ordered" thinning drops cells in an even, repeatable order; "random" scatters them. Either way the result is the same on every render and in every environment.
A projection that fades with distance
import { AreaChart } from "semiotic" const frameProps = { /* --- Data --- */ data: signups, /* --- Size --- */ height: 320, /* --- Process --- */ xAccessor: "month", yAccessor: "value", yExtent: [0,70], /* --- Customize --- */ curve: "monotoneX", color: "#3366ff", /* --- Annotate --- */ annotations: [{ type: "x-threshold", month: 8, label: "Now", color: "#161616" }], /* --- Other --- */ styleRules: [{ when: { axis: "x", lt: 8 }, style: { fillOpacity: 0 } }, { when: { axis: "x", gte: 8 }, style: { fillPattern: { density: { from: 1, to: 0.2, direction: "right" } }, strokeDasharray: "6 4" } }] } export default () => { return <AreaChart {...frameProps} /> }
Every shape
The lattice is laid into the mark's real outline, so wedges, circles, and irregular regions hold whole cells the same way a bar does. On a wedge the lattice is centered on the pie, so neighboring wedges line up.
A forecast slice
import { DonutChart } from "semiotic" const frameProps = { /* --- Data --- */ data: forecastSlices, /* --- Size --- */ height: 320, /* --- Process --- */ valueAccessor: "value", categoryAccessor: "category", /* --- Customize --- */ colorScheme: { Booked: "#3366ff", Committed: "#255f7d", Forecast: "#3366ff" }, /* --- Other --- */ styleRules: [{ when: { field: "category", eq: "Forecast" }, style: { fillPattern: "grid", stroke: "#3366ff", strokeDasharray: "4 3" } }] } export default () => { return <DonutChart {...frameProps} /> }
Planned services in a dependency graph
import { ForceDirectedGraph } from "semiotic" const frameProps = { /* --- Data --- */ nodes: serviceNodes, edges: serviceEdges, /* --- Size --- */ height: 360, /* --- Process --- */ nodeIDAccessor: "id", /* --- Customize --- */ colorBy: "state", colorScheme: { live: "#3366ff", planned: "#3366ff" }, nodeSize: "weight", nodeSizeRange: [14,26], showLabels: true, nodeLabel: "id", /* --- Other --- */ styleRules: [{ when: { field: "state", eq: "planned" }, style: { fillPattern: "grid", stroke: "#3366ff", strokeDasharray: "3 3" } }] } export default () => { return <ForceDirectedGraph {...frameProps} /> }
Map regions use one lattice for the whole map, so the cells in neighboring countries sit on the same grid.
Loading world map…
JSX
<ChoroplethMap areas={areas} valueAccessor="value" colorScheme="blues" styleRules={[ { when: (d) => d.properties.pending, style: { fillPattern: { pitch: 4, size: 2 } } }, ]} />
What a cell holds
cell can be any named symbol or a glyphdefinition, which fills a bar with whole pictograms. size is the mark's overall size, so every shape fits the same cell. This is a texture, not a count: the number of pictograms follows the bar's pixel size. For one sign per unit of data, use theunitize recipe or layoutCellGrid below.
Pictogram cells
import { BarChart } from "semiotic" const frameProps = { /* --- Data --- */ data: headcount, /* --- Size --- */ height: 320, /* --- Layout --- */ barPadding: 60, /* --- Process --- */ valueAccessor: "people", categoryAccessor: "team", /* --- Customize --- */ color: "#255f7d", /* --- Other --- */ styleRules: [{ style: { fillPattern: { cell: { viewBox: [18,40], parts: [{ d: "M9 2a4 4 0 1 1 0 8a4 4 0 0 1 0-8zM3 13h12v13h-2.5v12h-2.6V27H8.1v11H5.5V26H3z" }] }, pitch: [12,24], size: 20 } } }] } export default () => { return <BarChart {...frameProps} /> }
For anything the descriptor does not cover, cell can be a function. It is called for each cell with its position, the mark's datum, and a stable random number, and returns that cell's color, size, shape, or nothing to leave it empty. Here each bar mixes two colors in proportion to a field. A function is React-only; it cannot cross a JSON boundary.
Mixing colors by share
import { BarChart } from "semiotic" const frameProps = { /* --- Data --- */ data: tickets, /* --- Size --- */ height: 300, /* --- Layout --- */ barPadding: 60, /* --- Process --- */ valueAccessor: "total", categoryAccessor: "queue", /* --- Other --- */ styleRules: [{ style: { fillPattern: { pitch: 7, size: 5, cell: ({ datum: datum2, random }) => ({ color: random < datum2.resolved ? "#2a9d8f" : "#c9ced6" }) } } }] } export default () => { return <BarChart {...frameProps} /> }
The layout on its own
layoutCellGrid from semiotic/recipes is the same whole-cell layout as a pure function. Use it in acustom layout when you want each cell as a real scene node that can be hovered, labeled, or colored by data, or to arrange unit signs inside an arbitrary shape.
52 whole pictograms fit the outline; none is cut by it.JS
import { layoutCellGrid, fillRegionFromPath } from "semiotic/recipes" const { cells, size } = layoutCellGrid(fillRegionFromPath(outlinePath), { pitch: [12, 22], size: 18, shape: personGlyph, }) // In a custom layout, one glyph node per cell: const nodes = cells.map((cell, i) => ({ type: "glyph", x: cell.x, y: cell.y, size, glyph: personGlyph, style: { fill: i < supporters ? "#3366ff" : "#c9ced6" }, datum: null, }))
A region is a rect, a circle, or a polygon with any number of rings.fillRegionFromPath builds one from an SVG path andfillRegionFromSector from a pie or donut wedge.
How it is drawn
| Concern | Behavior |
|---|
| Edges | fit: "whole" draws a cell only when its mark lies fully inside the shape, clear of the outline by half the stroke width. fit: "center" draws it when the cell's center is inside. |
| Lattice origin | anchor: "auto" centers the lattice on bars, circles, symbols, and wedges, and uses one plot-wide lattice for areas and map regions, so stacked layers line up and a moving edge reveals fixed cells. Force either with "mark" or"plot"; "plot" suits streaming bars. |
| Canvas | The mark size and the pitch round to whole device pixels, so every cell is crisp and every gap is equal: a 2.5 px mark on a 3.5 px pitch draws a 3 px mark every 4 px at 1× and a 5 px mark every 7 px at 2×. The drawn pitch can differ from the one you asked for by up to half a device pixel. Set snap: false for the exact, antialiased geometry. |
| Server SVG | The same layout at the exact pitch and size, since SVG has no pixel grid to snap to. A uniform pattern is one dashed <path> per row however many cells it holds. |
| Opacity | The mark's opacity (and selection dimming) applies to the cells.fillOpacity does not: use the pattern's own opacity. |
| No interior | Lines, candlesticks, heat-map cells, and glyph marks have nothing to tile. They keep their normal paint. |
| Loading | The pattern engine is a separate chunk that loads the first time a chart asks for a pattern, so charts that never use one do not pay for it. Until it arrives, patterned marks are drawn as outlines (never as a solid stand-in), and the chart repaints when it lands. Call await preloadFillPatterns() to have cells on the very first paint, or before server-rendering client chart components.renderChart from semiotic/server always has it. |
| Small marks | A mark too small to hold a single cell keeps its solid fill, so it never turns hollow. |
A pattern is a second channel beside color, which helps when color alone carries meaning. The legend still shows the series color, so say in the chart's description what the pattern stands for.