Plotissimo FAQ

Short answers to "how do I …?" questions, with code you can paste. Every option is described in full in the user guide.

Points and labels

How do I give each point its own label?

Give the points as objects with a label, and show the labels with labels: "always" on the series (the default, "click", shows a label when its point is clicked). A point without a label shows none.

series: [{ name: "Scope 1", labels: "always", data: [
	{ x: 2019, y: 820, label: "Base year" },
	{ x: 2020, y: 760, label: "Covid dip" },
	{ x: 2021, y: 700 },
] }]

How do I give one point its own colour or marker?

Set color, marker, markerSize, markerFill or markerFillColor on that point. They change the marker only; the line keeps the colour of its series.

{ x: 2023, y: 610, label: "Target met", color: "#e11d48", marker: "triangle", markerSize: 12, markerFill: true }

Markers: "circle", "square", "triangle", "star", "x", "+". When points have markers or colours of their own, the legend shows only the series' line; legendMarker: true on the series shows its marker anyway.

How do I change the colour of one point's label?

Set labelColor on the point, or labelClassName to style it with your own CSS. This works for the labels of line, bubble, bar, bullet and matrix charts.

{ x: 2023, y: 610, label: "Target met", labelColor: "#e11d48" }
{ x: 2023, y: 610, label: "Target met", labelClassName: "highlight" }
.plotissimo .highlight { fill: #e11d48; font-weight: 600; }

A label runs over the line. Can I move it?

Line labels go above or below their point, on the side away from the line. To choose yourself, set labelPosition on the series or on one point: "above", "below", "left", "right" or "auto" (the default).

{ x: 2021, y: 700, label: "Heat pump", labelPosition: "right" }

The first and last points touch the edge of the chart. Can they move inward?

Give the plot area some padding: the points keep that distance from the edge, the axis and gridlines still run to it.

plotArea: { padding: [0, 14] }   // 14 px left and right

Lines

Can a line change colour part of the way, e.g. actual and forecast?

Not within one series: a series' line has one colour and one dash style. Use two series that share the point where they meet:

series: [
	{ name: "Actual", data: [[2019, 820], [2020, 760], [2021, 700]] },
	{ name: "Forecast", lineStyle: "--", color: "#e11d48", data: [[2021, 700], [2022, 650], [2023, 610]] },
]

How do I give a line chart a glow, a shadow or a gradient?

Effects are a chart option: "elevated" (soft shadows, lines lifted a little) and "glow" (a glow in each line's own colour, made for the dark theme), alone or together. A gradient under a line needs area: true on the series.

new Plotissimo.LineChart("#chart", {
	theme: "dark",
	effects: ["elevated", "glow"],
	series: [{ name: "Scope 2", area: true, gradient: "strong", data: [[2019, 410], [2023, 210]] }],
});
chart.setEffects(["glow"]);   // or change them later

gradient: true, "subtle", "strong", or your own { direction, stops }. Effects are CSS, so you can also write your own, e.g. a thicker glow on one series:

.plotissimo .scope-1 .pl-line { filter: drop-shadow(0 0 8px var(--pl-c)); }   /* --pl-c: the series colour */

Animation

How do I turn the animation off, or make it shorter?

new Plotissimo.BarChart("#chart", { animation: false, series: [...] });                     // none
new Plotissimo.BarChart("#chart", { animation: { duration: 400, update: false }, ... });   // only the entrance, faster
chart.update({ animation: false });                                                         // later

enter is the entrance on the first draw, update the move after a change (new data, a series hidden). Charts never animate when the visitor's system asks for less motion, and an export always shows the finished chart.

Themes and colours

How do I use another theme, or make my own?

Built in are default, dark, minimal (no plot area background or border, a very light grid), blue (shades of one blue on a light ground), blue-dark (light blues on deep navy), terminal (glowing green on black, like an old CRT terminal) and terminal-amber.

new Plotissimo.LineChart("#chart", { theme: "dark", series: [...] });
chart.setTheme("minimal");   // switch while the page is open

Your own theme is a set of CSS variables on .plotissimo.pl-theme-<name>; define only what differs from the default.

.plotissimo.pl-theme-corporate {
	--pl-font: "Inter", sans-serif;
	--pl-bg: #ffffff;
	--pl-plot-bg: #f5f7fb;
	--pl-color-0: #172554;   /* first series */
	--pl-color-1: #f59e0b;   /* second series */
}
chart.setTheme("corporate");

The variables are listed in the guide.

How do I change only the series colours?

Use the palette option, or color on one series. Built-in palettes: "colorblind", "blue" (light backgrounds) and "blue-dark" (dark backgrounds). A palette changes only the series; the theme still sets the background, text and gridlines.

palette: ["#172554", "#f59e0b", "#10b981"]
chart.setPalette("colorblind");
chart.setPalette(null);   // the theme's colours again

Can the chart follow the visitor's light or dark mode?

Not by itself: choose the theme from the page's setting.

const dark = window.matchMedia("(prefers-color-scheme: dark)");
chart.setTheme(dark.matches ? "dark" : "default");
dark.addEventListener("change", (e) => chart.setTheme(e.matches ? "dark" : "default"));

Bars

Can bars have rounded corners?

Yes: cornerRadius in pixels. By default only the value's end is rounded (the top of a column, the outer end of a bar; in a stack only the outer segment), so the bars still stand square on the baseline. corners: "all" rounds all four.

series: [{ name: "Recycled", cornerRadius: 6, data: [["Q1", 12], ["Q2", 15]] }]
seriesDefaults: { bar: { cornerRadius: 6 } }   // for every bar series of the chart

How do I make horizontal bars, or bars that start at the top or the right?

new Plotissimo.BarChart("#chart", { orientation: "horizontal", series: [{ data: [["Q1", 12], ["Q2", 15]] }] });
new Plotissimo.BarChart("#chart", { from: "top", ... });                               // columns hanging down
new Plotissimo.BarChart("#chart", { orientation: "horizontal", from: "right", ... });  // bars from the right
chart.update({ orientation: "horizontal" });                                            // turn it later

The data stay [category, value] in every direction.

How do I give the data of a stacked bar chart?

One series per part of the stack, each with the same stack name and its values as [category, value]. The first series is the bottom of the stack. A category missing in a series adds nothing there.

new Plotissimo.BarChart("#chart", {
	stackTotals: true,   // the total above each stack
	series: [
		{ name: "Scope 1", stack: "emissions", labels: true, data: [["2025", 540], ["2026", 510]] },
		{ name: "Scope 2", stack: "emissions", labels: true, data: [["2025", 160], ["2026", 120]] },
	],
});

Series with another stack name form a second stack next to the first, e.g. stack: "target"; series without stack are ordinary bars beside the stacks. stackMode: "percent" makes every stack add up to 100.

How do I change the label of one segment of a stack?

Give that value as an object with a label; labels: true must be on for the series. labelColor and labelClassName work here too. A segment too thin for its label (under 14 px; 24 px for horizontal bars) shows none.

{ name: "Scope 2", stack: "emissions", labels: true, data: [
	["2025", 160],
	{ x: "2026", y: 120, label: "120 (-25%)", labelColor: "#facc15" },
] }

To change all labels of a series in one go, use format: format: (value) => value + " t".

Can I add annotations to a chart?

Yes: annotations is a list of free notes. A note can have a line with an arrowhead to what it is about: a line's point, a bar or a segment of a stack ({series, x}), a place on a line between two points, or any position in data values ({x, y}, e.g. on a reference line or in a zone).

annotations: [
	{ text: "New supplier", target: { series: "Scope 2", x: "2024" } },            // 40 px right and up from it
	{ text: "Covid dip", target: { series: "CO₂", x: 2020 }, dx: 30, dy: 50 },     // where the note goes, in pixels
	{ text: "Target", target: { x: 2023, y: 500 }, color: "#e11d48" },
	{ text: "Preliminary figures", x: "50%", y: "6%", box: false },                  // a note without a line
]

Options: line: false (no line), arrow: false (a line without an arrowhead), box: false (no box), title (a text on hover), className. A note on a series hides with that series. For a text that belongs to one value only, the value's own label is often enough:

{ x: "2026", y: 120, label: "New supplier" }

Reference lines and zones (plotArea.lines, plotArea.fills) have a label of their own.

How do I style the box of an annotation?

In the options: box: false (text only) and color (text, border, line and arrow). Everything else is CSS on the classes pl-annotation-box, pl-annotation-text, pl-annotation-line and pl-annotation-arrow; a className on the note styles one note only.

.plotissimo .pl-annotation-box { fill: #fef9c3; stroke: #ca8a04; stroke-width: 1.5; stroke-opacity: 1; }
.plotissimo .pl-annotation-text { font-size: 13px; font-weight: 600; }
.plotissimo .warning .pl-annotation-box { fill: #fee2e2; stroke-dasharray: 4 2; }   /* className: "warning" */

The padding inside the box and its corner radius are fixed.

How do I change the total above a stack?

Give stackTotals a function instead of true. It gets the total and {category, negative, stack} and returns the text; null leaves that total out.

stackTotals: (total, { category }) => category === "2024" ? `${total} t (restated)` : `${total} t`,
stackTotals: (total, { category }) => category === "2025" ? null : total,   // no total above 2025

With effects: ["elevated"], does every segment of a stacked bar get its own shadow?

No: a stack casts one shadow around its outside, so no shadow falls between the segments. All stacked series are drawn in one group, pl-stacks; style it to change the shadow of the stacks only.

.plotissimo.pl-effects-elevated .pl-stacks { filter: drop-shadow(3px 4px 4px rgba(0, 0, 0, 0.3)); }

Axes

How are very large numbers written, e.g. a market capitalisation in dollars?

Short, from a million on: the axis in one unit for all its ticks ("1T", "1.5T", "2T"), labels and the hover box "3.9T" or "420M". From 10,000 on numbers are grouped ("250,000"); below that they stay as they are, so years read 2026. The scale's locale sets the language: scales: { y: { locale: "nl" } } gives "3,9 bln." and "250.000". Screen readers get the full number. Your own text replaces it: axes.left.labels.format for the axis, format on the series for labels and the hover box, e.g. to write "$3.9 trillion".

How are very small numbers written, e.g. 0.00000000123?

With a power of ten, below 0.001: labels and the hover box "1.23 × 10⁻⁹", and the axis writes its power once, in its title, with plain ticks: "Concentration (× 10⁻⁹ mol/L)" over 1, 1.5, 2, …. Screen readers hear "1.23 times 10 to the power of minus 9". From 0.001 on numbers stay as they are ("0.00123"). Your own axes.left.labels.format and series format replace it, e.g. to write nanograms: labels: { format: (v) => ${v * 1e9} } with unit: "ng".

My axis of years shows 2020.0, 2020.5, …. How do I get whole years?

Axes whose values are all whole numbers (years, counts) get whole steps by themselves. If you still see half years, the values are not whole numbers, or the axis has integer: false. To force whole steps, set integer: true on the axis; for a fixed step, step: 1.

axes: { bottom: { title: "Year", integer: true } }

How do I show gridlines between the labelled ticks?

Turn on the minor gridlines of the plot area; ticks.minor.count on the axis sets how many fall between two labels.

plotArea: { grid: { vertical: { minor: { show: true } } } },
axes: { bottom: { ticks: { minor: { count: 3 } } } }   // quarters between years

I made my chart narrower and now the text is bigger. Why?

Because the chart is scaled to its container: with responsive: true (the default) it is drawn at your width and then enlarged to the container's width, text, dots and lines with it. A width: 360 chart in a 560-pixel box grows about 1.5 times, while its parts are still placed for 360 pixels, so texts move closer together. Smaller fonts in CSS fight the scaling instead of stopping it. Choose one of these:

new Plotissimo.SlopeChart(el, { width: 360, height: 400, responsive: false, ... });   // exactly 360 × 400 pixels
new Plotissimo.SlopeChart(el, { responsive: "fill", ... });   // the container's size (set it in CSS), text at its real size

or keep responsive: true and give the container max-width: 360px, so the chart is never enlarged.

A slope chart that is really narrow for its columns (five years in 300 pixels) also makes room itself: its end labels wrap further, and when the column names still do not fit, it shows every second one (always the first and the last).

Popups

How do I turn the hover box off, or change it?

The box beside the pointer (tooltip) is on for every chart. tooltip: false turns it off (the browser's own tooltip, after a second, remains). Its look is the class plotissimo-tooltip in CSS; tooltip: { className: "x" } adds a class of your own. On line and bar charts tooltip: { format: ({x, items}) => text } writes your own text.

How do I style a popup and a form in it?

With CSS. The popup is a <div class="plotissimo-popup pl-theme-<theme>"> in document.body, so it has the chart's theme variables (--pl-bg, --pl-text, --pl-muted, --pl-color-0, --pl-plot-border, --pl-font). Its parts: .pl-popup-title, .pl-popup-body, .pl-popup-actions, .pl-popup-action (the buttons of actions) and .pl-popup-close (the ×). A form you return as content is your own HTML: give it a class and style it with the same variables, so it follows the theme (dark too):

popup: { className: "edit-popup", content: (c) => ({ title: "Edit", content: myForm(c) }) },
.plotissimo-popup.edit-popup { max-width: 260px; border-radius: 12px; }
.edit-popup input { font: inherit; color: var(--pl-text); background: var(--pl-bg); border: 1px solid var(--pl-plot-border); border-radius: 6px; padding: 3px 6px; }
.edit-popup button[type="submit"] { background: var(--pl-color-0); color: #fff; border: none; border-radius: 6px; padding: 4px 12px; }

popup.className adds your class to the popup of this chart only; without it, .plotissimo-popup styles every popup.

How do I save what someone changes in a popup form, e.g. in a database?

In your own form's submit handler: the form is your HTML, so the chart has no "data changed" event; you decide when the data changes. Send it to your server, and redraw the chart with chart.update({ series }) when the server has accepted it:

form.addEventListener("submit", async (event) => {
	event.preventDefault();
	const values = [Number(form.elements.a.value), Number(form.elements.b.value)];
	const response = await fetch(`/api/kpis/${item.id}`, {
		method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ values }),
	});
	if (!response.ok) {
		form.querySelector(".error").textContent = "Not saved, try again";   // the popup stays open
		return;
	}
	item.values = values;                 // your data, the same objects the series uses
	chart.popup.close();
	chart.update({ series });             // redraw with the saved values
});

It helps to keep the saving in one function that returns a promise of { ok, status, error }: the form stays the same whether that function calls your server, or (in a test or a demo) only waits a moment and answers itself:

const server = {
	async put(id, values) {
		try {
			const response = await fetch(`/api/kpis/${id}`, {
				method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ values }),
			});
			if (response.ok) {
				return { ok: true, status: response.status };
			}
			const body = await response.json().catch(() => ({}));
			return { ok: false, status: response.status, error: body.error ?? response.statusText };
		} catch {
			return { ok: false, status: 0, error: "No connection" };   // offline, server not reachable
		}
	},
};
// in the submit handler: const result = await server.put(item.id, values); if (!result.ok) { show result.error }

Any other way of saving works the same way (axios, XMLHttpRequest, your framework's own function), as long as it returns that result. Check the values on the server too: min and max on the inputs only help the user. The playground page slope.html has a scenario with a fake server that is slow, refuses values outside 0-100 and can be switched off.

The chart's own events help around it: popupOpen and popupClose (with node and context), and the click on a part (e.g. series:item:click) with the data point in c.datum. Keep an id in your data points (any extra field is kept), so the handler knows which record to save.

Can the popup form also add a note that points at the data point?

Yes: a note is an annotation with a target (the series' name and the point's x, category or slice label), so the form keeps one text field next to the number, and saving updates both the data and the chart's annotations. The chart's options keep the notes (chart.options.annotations), so the form can show the note that is already there; an empty note removes it.

const noteOf = (series, x) => (chart.options.annotations ?? []).find((a) => a.target?.series === series && a.target?.x === x)?.text ?? "";
const withNote = (series, x, text) => [
	...(chart.options.annotations ?? []).filter((a) => !(a.target?.series === series && a.target?.x === x)),
	...(text ? [{ text, target: { series, x } }] : []),
];

// in the popup's content(c) for a bar: c.datum.series.options.name and c.datum.category
// (a line's point: c.datum.datum.x; a pie slice: c.datum.datum.label), the field filled with noteOf(...)
form.addEventListener("submit", (event) => {
	event.preventDefault();
	c.datum.datum.y = Number(form.elements.value.value);
	chart.popup.close();
	chart.update({ series, annotations: withNote(c.datum.series.options.name, c.datum.category, form.elements.note.value.trim()) });
});

A note can have several lines: use a <textarea> for it, its line breaks become "\n". Without a place of its own (dx, dy, x, y) a note finds a place that covers no other note, then no points or bars, then no lines, so notes added one by one do not pile up. Notes can point at a line's point, a bar (a stack segment, a side of a population pyramid) and a pie slice. Save the notes with your data (see the question above) and give them back as annotations when you draw the chart again. The playground pages line.html, bar.html, stacked.html, pie.html and pyramid.html do this in "Click opens a form".

Why are some category names under my bars missing, or on two lines?

A name wider than its bar's band goes onto two lines, wrapped at a space ("Storage and / export"). When the names do not fit side by side even then (one long word, or many bars in a narrow chart), they all turn -30 degrees, so every name shows (labels.rotate: "auto", the default). Your own angle wins (axes.bottom.labels.rotate: -45); rotate: 0 keeps them flat, and names that would overlap are then left out. labels.wrap: false keeps every name on one line.

Text and fonts

How do I change the font of the whole chart?

Set the theme variable --pl-font; every text in the chart uses it.

.plotissimo { --pl-font: "Inter", sans-serif; }
#sales .plotissimo { --pl-font: Georgia, serif; }   /* one chart only */

A web font has to be loaded first. If it loads after the chart was drawn, call chart.draw() once afterwards, so the text is measured in the right font.

How do I change the font of the data labels, or of one series' labels?

Data labels have the class pl-data-label. Give a series a className to style only its labels.

.plotissimo .pl-data-label { font-size: 13px; font-weight: 600; }
.plotissimo .scope-1 .pl-data-label { font-style: italic; }   /* series with className: "scope-1" */

Other texts: pl-title-text, pl-subtitle-text, pl-legend-label, pl-tick-label, pl-axis-title.

How do I change the font size or colour of the legend?

In CSS: the legend has no font options (fontSize, fontColor), like the other parts of a chart. Options it does not know are ignored without a message; // @ts-check in a separate .js file makes the editor point them out (see "Finding errors" in the guide).

.plotissimo .pl-legend-label { font-size: 15px; fill: #000; }   /* SVG text: fill is the colour */
#sales .plotissimo .pl-legend-label { font-size: 15px; }         /* one chart only */

symbolSize (an option) sets the size of the dots or lines in front of the labels.

How do I hide the title or the subtitle?

title: { text: "CO₂ emissions", subtitle: "tonnes", visible: false }   // both hidden, no space taken
title: { text: "CO₂ emissions" }                                         // no subtitle
chart.update({ title: { visible: true } })                               // switch while the page is open

A hidden title still names the chart for screen readers. If you leave text empty, give the chart a name with accessibility: { label: "CO₂ emissions" }.

Pie and donut

How does clicking a slice work?

A click on a slice moves it out and every other slice back in. A second click on it, or a click anywhere else (on the chart or the page), moves it back. Hovering only lightens a slice. With selectable: "multiple" several slices can be out, each click moves one out or back; selectable: false turns it off, and explode sets the distance (pixels).

series: [{ explode: 10, data: [["Netherlands", 48], ["Germany", 31]] }]
chart.on("selectionChange", (c) => console.log(c.selected));   // the keys of the slices that are out

Can the title be centred over the pie instead of over the whole chart?

That is the default for pie and donut charts: the title is centred over the pie, the legend beside it is left out. span decides this for every chart type: "plot" over the plot area (the pie), "chart" over the full width.

title: { text: "Suppliers per country", span: "chart" }   // over the pie and its legend
title: { text: "Energy use", span: "plot" }               // a line chart: over the plot area, not the axis labels

Does every slice get its own shadow with effects: ["elevated"]?

No: the pie (or donut) casts one shadow as a whole. A slice that steps out after a click casts its own shadow into the gap, which never falls on another slice.

How do I set the width of the donut ring and of the lines between the slices?

The ring is innerRadius (the hole, as a fraction of the radius): the higher, the thinner the ring. The line between two slices is the outline of each slice, set in CSS; padAngle puts real space between them instead.

series: [{ innerRadius: 0.75, data: [...] }]   // a thin ring (0.5: thick; 0: a full pie)
series: [{ innerRadius: 0.6, padAngle: 2, data: [...] }]   // 2 degrees of space between the slices
.plotissimo { --pl-slice-line: #0f172a; --pl-slice-line-width: 3px; }   /* colour and width (default: background, 1.5px) */
.plotissimo { --pl-slice-line-width: 0; }                                /* no line */

The legend's dots get the same line, so they match the slices. (Styling .pl-pie-arc itself changes only the slices.)

Can the slices have rounded corners?

Yes: cornerRadius in pixels on the series. A pie slice is rounded on the outside, a donut slice on the outside and the inside. On a thin slice or a thin ring the corners get smaller, so they always fit. Together with padAngle the slices stand apart as rounded pieces; the gaps are equally wide from the outside to the hole.

series: [{ innerRadius: 0.6, cornerRadius: 8, padAngle: 2, data: [...] }]

Why is there so much space between the title and a half donut?

The pie is centred in its plot area. A half donut (startAngle: -90, endAngle: 90) is twice as wide as it is high: when the width decides its size, the height that is left over goes equally above and below it. Give the chart a height: "auto": the chart then takes the height its shape needs at its width.

new Plotissimo.PieChart("#chart", { width: 520, height: "auto", series: [{ startAngle: -90, endAngle: 90, ... }] });

Works in every responsive mode; in "fill" mode the chart takes the box's width and its own height.

How do I add an annotation to a pie chart?

With the chart option annotations, as on other charts. A slice is named by its label: the arrow points at the middle of its outside edge. Place the note with dx / dy (pixels from that point), or anywhere with percentages.

annotations: [
	{ text: "New supplier\nin 2026", target: { series: 0, x: "Germany" }, dx: -60, dy: 30 },
	{ text: "Preliminary", x: "50%", y: "50%", box: false },   // in the middle of a donut
]

series is the pie series' name or its place in the list (0 for the first).

To point at the slice's label instead (inside or outside the pie), add at: "label"; the arrow ends at the edge of the text.

{ text: "Up from 22%", target: { series: 0, x: "Germany", at: "label" }, dx: -150, dy: 60 }

Sparkline

What can I set on a sparkline?

A sparkline is a line chart without axes, legend and title, 120 × 32 pixels and the same size everywhere (responsive: false). Every chart and line option works; the ones you use most:

new Plotissimo.SparklineChart(cell, {
	width: 200, height: 44,                       // size; responsive: true fills a tile's width
	plotArea: { fills: [{ y0: 60, y1: 70, color: "#94a3b8", opacity: 0.2 }],   // a normal range
		lines: [{ y: 65 }] },                       // a target line
	series: [{
		data: [[1, 61], [2, 63], [3, 64]],
		area: true, gradient: "subtle",              // filled below the line
		points: "extremes",                         // markers: "last" (default), "first-last", "min-max", "extremes", true, false
		color: "#0f766e", lineStyle: "--",           // colour, dashes; the width: lineWidth (default 1.5)
	}],
});

Bars instead of a line: series: [{ type: "bar", data }] with scales: { x: { type: "band" } }. Markers on the lowest and highest point are red and green (classes pl-point-min / pl-point-max).

What do the values of points mean, and what is the same for bars?

points (lines) decides which points get a dot; highlight (bars) which bars are full colour, the others lighter. Both take the same values:

Value Marked
"last" the most recent value (the default for sparkline points)
"first-last" the first and the last
"min-max" the lowest (red) and the highest (green)
"extremes" the lowest, the highest and the last

points also takes true (every point) and false (none). "extremes" is "min-max" plus the last value. Bars: classes pl-bar-min, pl-bar-max, pl-bar-first, pl-bar-last and pl-bar-dim (the others) for your own colours.

Can a sparkline show its values on hover?

Yes, by default: moving over it shows the value at the nearest point (or bar) in a small box beside the pointer, with a dot on the line (an outline around the bar). With the keyboard focus on the chart, the arrow keys move along the values. Other charts get it with the chart option tooltip: true; with several lines the box lists each of them.

tooltip: { format: ({ x, items }) => `${x}: ${items[0].value} t CO₂e` }   // your own text
tooltip: false                                                            // none

How do I put sparklines in a table?

One small chart per cell; they keep the same size (responsive: false), so the column stays even. The playground page sparkline-table.html has a complete example.

for (const site of sites) {
	const tr = document.createElement("tr");
	tr.innerHTML = `<td></td><td class="spark"></td><td class="num"></td>`;
	const [name, spark, latest] = tr.children;
	name.textContent = site.name;          // text, never markup
	latest.textContent = site.values.at(-1);
	rows.appendChild(tr);
	new Plotissimo.SparklineChart(spark, {
		width: 140, height: 30,
		series: [{ name: site.name, area: true, points: "extremes", data: site.values.map((v, i) => [months[i], v]) }],
	});
}
td.spark { padding: 2px 14px; line-height: 0; }   /* no extra space under the chart */

In a larger table with text: give the sparkline about the height of a text row (height: 20 for 14px text) and vertical-align: middle on the cells; a row that grows (a note over two lines) keeps the sparkline in its middle. A fixed width keeps the column even. Every sparkline scales to its own lowest and highest value, so the shapes show each row's trend, not how the rows compare; for the same scale in every row give it to all of them:

scales: { y: { min: 0, max: 100 } }   // e.g. scores out of 100: the heights compare across rows

Which kinds of sparklines are there?

Line, area, column (type: "bar") and bar (orientation: "horizontal"), each with the options of its series. The playground page sparkline-gallery.html shows them all side by side: markers on the extremes, gaps, dates, a gradient with a zero line, the same scale in every row, highlighted and negative columns, several bars, and progress bars with the value inside, a colour by value, or the value on the right or in the centre.

Data can be a plain list of numbers; a null is a gap in the line:

series: [{ data: [61, 63, null, 66, 65] }]          // x: 0, 1, 2, ...; connectGaps: true draws across the gap
series: [{ type: "bar", labels: true, labelPosition: "center", data: [["Renewable", 72]] }]

Can a sparkline be a single horizontal bar, for one value?

Yes: orientation: "horizontal" and one bar; scales.x.max is the full length (without it the bar always fills the width, since it is the largest value). A horizontal sparkline has no room left and right and a light track behind the bar (the plot area background), so a bar of 100 out of 100 reaches the end of the track. In a table, responsive: "fill" makes it as wide as its cell; with a fixed width a column that is wider (e.g. by its heading) shows the bar shorter than the cell.

new Plotissimo.SparklineChart(cell, {
	height: 14, orientation: "horizontal", responsive: "fill",   // as wide as the cell
	scales: { x: { max: 100 } },                                  // 72 of 100: 72 % of the width
	series: [{ type: "bar", data: [["Renewable energy", 72]] }],
});

With labels: true the value is inside the bar, at its end (after the bar when it is too short for the text); labelPosition: "left" puts it at the bar's left end, "right" at the right end of the track (the values in a column). A label never changes the bar: a full bar stays full.

series: [{ type: "bar", labels: true, format: (v) => `${v}%`, data: [["Renewable energy", 72]] }]

The track is a light shade of the first palette colour, the theme variable --pl-track; plotArea: { background: false } leaves it out.

.plotissimo { --pl-track: #e2e8f0; }   /* a grey track */

With a target and ranges (poor / fair / good) behind it, use a one-row bullet chart instead:

new Plotissimo.BulletChart(cell, {
	width: 110, height: 20, padding: 0, responsive: false, legend: false,
	axes: { left: { visible: false }, bottom: { visible: false } },
	scales: { x: { max: 100 } },
	series: [{ ranges: [50, 75, 100], data: [{ label: "Renewable energy", value: 72, target: 80 }] }],
});

Can I set the theme (or other options) for all sparklines on a site?

Yes, once, before the charts are made; a chart's own options still win:

Plotissimo.setDefaults("sparkline", { theme: "blue", height: 24 });   // every sparkline
Plotissimo.setDefaults({ theme: "blue" });                             // every chart

Colours alone can also come from CSS, for every chart with a class of yours: className: "spark" and .plotissimo.spark { --pl-color-0: #0f766e; --pl-track: #ccfbf1; }.

Sunburst

Why does a segment show a shortened name, or none?

A label is drawn only where it lies inside its segment: horizontal, curved along the arc, or along the radius, whichever fits first. Where no way fits the whole name, it is shortened with "…"; a sliver too small for even two letters has none. The hover box always shows the whole path and value ("Scope 3 › Transport › Road: 380"). Shorter names (shortLabel), a bigger chart, or fewer levels (zoom in with a click) make room.

How do I show the names only on hover?

labels: false. Sunbursts show the hover box at once (tooltip: true is their default); tooltip: false leaves only the browser's own tooltip, which comes after a second and not on touch screens.

Heat map

Why are my columns (or rows) in the wrong order?

Columns and rows are in the order they first appear in the data. When the first row misses a value (no April for Rotterdam), April only appears later and its column ends up further right. Give the order yourself:

scales: { x: { type: "band", paddingInner: 0, paddingOuter: 0, categories: ["Jan", "Feb", "Mar", "Apr", ...] } },

The same for rows with scales.y.categories (a heat map has the first row at the top: keep reverse: true).

How do I show the cells that have no value?

With emptyColor, e.g. emptyColor: "#e5e7eb": every place of the grid without a value gets a cell in that colour, whether the data has it with value: null or does not have it at all. Without emptyColor such cells are left out and the background shows through.

Bullet

Can a bullet chart compare two series, such as this year and the plan?

Yes: give it two series with the same row labels. They lie side by side in each row, the first at the top, with the ranges behind them once; each named series gets a legend item, and a click on it hides that series.

legend: { visible: true, position: "bottom" },
series: [
	{ name: "2026", ranges: [50, 75, 100], data: [{ label: "Waste recycled", value: 47, target: 60 }] },
	{ name: "Plan 2027", data: [{ label: "Waste recycled", value: 65 }] },
],

For one earlier value per row, previous (a thin dark bar on the value bar) takes less room.

How do I show negative values, such as a reduction?

Give the scale its range (scales: { x: { min: -60, max: 0 } }) and the ranges as their ends, from the lowest: the first starts at the scale's minimum. When more negative is better, colour the ranges yourself:

ranges: [
	{ to: -40, color: "#bbf7d0", label: "On track" },
	{ to: -20, color: "#fde68a", label: "Behind" },
	{ to: 0, color: "#fecaca", label: "Far behind" },
],

Bars run from zero to the value, so a scale across zero shows bars to both sides; labels go to the bar's end (left, or below for columns).

How do I change the colour of the previous value?

With previousColor: on the series for every row, or on a row's data for that row (it wins). Without it, the bar is the theme's text colour at 85 %.

series: [{ ranges: [50, 75, 100], previousColor: "#6366f1", data: [
	{ label: "Waste recycled", value: 47, target: 60, previous: 51, previousColor: "#e11d48" },   // this row red
	{ label: "Employees trained", value: 93, target: 95, previous: 88 },
] }]

CSS works as well: .plotissimo .pl-bullet-previous { fill: #6366f1; }. The bar has a thin outline in the theme's background colour (white in the light themes), so it stands out on the value bar; --pl-bullet-previous-outline gives it another colour, stroke-width: 0 on .pl-bullet-previous leaves it out.

Radar

My small radar (in a tile) is tiny. How do I make it bigger?

The category names take their room on every side: the width of the widest name left and right. In a small tile leave them out with radar.categoryLabels: false: the radar then fills the chart, and hover still shows the name and value of each point. A number in the centre (centerLabel) gives the tile its key figure:

const average = (series) => Math.round(series[0].data.reduce((sum, d) => sum + d.value, 0) / series[0].data.length);
new Plotissimo.RadarChart(tile, {
	width: 180, height: 180,                       // under 260 pixels: no legend
	radar: { max: 100, tickLabels: false, categoryLabels: false, centerLabel: average, centerSubLabel: "average" },
	series: [{ name: "Acme", data: [["Identity", 92], ["IT", 64], ["ESG", 71], ["Financial", 85], ["Delivery", 58]] }],
});

centerLabel is a text or a function of the visible radar series; centerSubLabel a smaller line under it. A radar under 260 pixels wide or high leaves out its legend; legend: { visible: true } brings it back.

Slope

Can a slope chart show two groups, such as two countries?

Yes, as two series: they share the columns and their labels are pushed apart together. The colours still tell better from worse, so each series gets its own line style (the first solid, the second dashed, the third dotted), shown in grey in the legend; lineStyle on a series chooses one yourself. Putting the group in the item names helps too:

series: [
	{ name: "Netherlands", columns: ["2025", "2026"], unit: "%", data: [["Renewable NL", 48, 62], ["Women NL", 35, 38]] },
	{ name: "Belgium", columns: ["2025", "2026"], unit: "%", data: [["Renewable BE", 41, 45], ["Women BE", 30, 29]] },
],

How does lowerIsBetter work?

It is set per item and only changes what counts as better. The change is the last value minus the first (the values between do not count). Normally a rise is better (green) and a fall worse (red); with lowerIsBetter: true it is the other way round, for things like emissions, waste or staff turnover. No change is grey either way.

data: [
	["Renewable energy", 48, 62],                                         // up: green
	{ label: "Staff turnover", values: [12, 15], lowerIsBetter: true },   // up: red
]

The line itself still goes up or down. Clicks and popups get direction ("up", "down", "flat") and verdict ("better", "worse", "flat"). With colorBy: "palette" the colours do not show the verdict, so it has no visible effect there.

My item names are long. Do they push the lines aside?

No: an end label takes at most about a third of the chart's width; a longer name wraps onto more lines, centred on its point. Short names (with the full name in a tooltip or a table) still read best.

Limit diagram

With flow: true (off by default): small ">" arrows just above the axis between each pair of links show the direction of the flow through the chain, from the first link to the last (inflow, pumps, separation, export). Their colour is the class pl-limit-flow in CSS, e.g. .plotissimo .pl-limit-flow { stroke: #94a3b8; }.

Gauge

How do I give a gauge coloured ranges, such as low, medium and high?

With bands: each band is a range of the scale with a colour and an optional label (the labels are the legend items). The value arc takes the colour of the band its value is in.

new Plotissimo.GaugeChart("#chart", {
	series: [{ value: 72, unit: "%", label: "Score", bands: [
		{ to: 50, color: "#ef4444", label: "Low" },
		{ to: 75, color: "#f59e0b", label: "Medium" },
		{ to: 100, color: "#10b981", label: "High" },
	] }],
});

A band without from starts where the band before it ends (the first at min), so this is 0–50, 50–75 and 75–100. You can also give both ends: { from: 50, to: 75, ... }. A value on a boundary (50) takes the later band.

How does a gauge animate?

When it is first drawn, the value arc grows from the start of the scale to the value, a needle (needle: true) turns from the start to the value, and the bands fade in. This entrance plays on the first draw only: after update() with a new value the arc is drawn at the new value at once. animation: false draws it at once, and people who ask their system for less motion get no animation.

How do I show several values in one gauge?

Give the chart several gauge series: each one gets its own ring, the first on the outside. Their values are not shown in the middle, where they would overlap. Put your own text there with the chart options centerLabel and centerSubLabel, and turn on the legend for the names:

new Plotissimo.GaugeChart("#chart", {
	centerLabel: "Scores", centerSubLabel: "2026", legend: { visible: true },
	series: [{ name: "Environment", value: 72 }, { name: "Social", value: 58 }, { name: "Governance", value: 81 }],
});

To place the rings yourself, give each series innerRadius and outerRadius. showValue: true shows a series' value in the middle anyway. The rings share one scale, outside the outer ring, when they have the same min, max and angles; ticks: false on a series turns its ticks off.

Can a gauge show its value on the ring itself?

Yes, with valueLabel: true: the value is written on the ring, turned along it, at the end of the value arc. When the arc is too short for it, it goes just after the end, on the track. With several gauges in one chart this is on by default (their values are not in the middle); valueLabel: false turns it off.

Can I change the corners of a gauge's arcs?

rounded: true (the default) gives the track and the value arc fully round ends, rounded: false square ends. For anything in between, give cornerRadius in pixels: cornerRadius: 4 rounds the corners at the ends a little. A corner never grows past half the ring's width, so a large value gives fully round corners.

How do I show the scale of a gauge, e.g. 0% to 100%?

With ticks (on by default for a single gauge). The labels get the series' unit, so unit: "%" gives "0%" … "100%":

series: [{ value: 72, unit: "%", ticks: { step: 25 } }]   // 0% 25% 50% 75% 100%

step: 100 labels only the ends (0% and 100%), minor: 4 adds small ticks between the labels, labels: false shows ticks without numbers, unit: false numbers without the unit, and ticks: false no scale. With several gauges on the same scale there is one scale for all, outside the outermost ring; on different scales each ring has its own, with room kept for it.

Can the track show a light shade of the bands, instead of a separate ring?

Yes, with bandPosition: "track": the bands are drawn on the track itself, as a light shade of their colours, and the value arc lies on top in the colour of its band. bandOpacity sets how light (default 0.25 on the track):

series: [{ value: 72, unit: "%", bandPosition: "track", bands: [
	{ to: 50, color: "#ef4444", label: "Low" },
	{ to: 75, color: "#f59e0b", label: "Medium" },
	{ to: 100, color: "#10b981", label: "High" },
] }]

Can the scale of a gauge be on the outside?

Yes, with ticks: { position: "outside" }: the ticks sit just outside the ring (beyond the band ring, if the bands are outside) and their labels further out. The gauge gets a little smaller to make room; between rings of several gauges there is room for them too.

series: [{ value: 72, unit: "%", ticks: { step: 25, position: "outside" } }]

Does a gauge have a legend?

Yes, but it is off by default (one gauge seldom needs one): legend: { visible: true }. It lists the labelled bands (label on a band), or, for gauges without labelled bands, the series names. A series name has the colour its value arc has (the colour of its band). When several gauges have the same bands (same label and colour), each band is listed once. legend: { position: "right" } and the other legend options work as for every chart.

With several gauges, how do I tell the rings apart?

Every ring shows its series name at its start, in the open part of the circle just before it, so a ring can be told apart even when two rings have the same colour (the value arc takes the colour of its band). This is on by default with several gauges, unless the legend shows the series names (legend: { visible: true }, bands without labels); nameLabel: false turns it off for a series, nameLabel: true turns it on (also next to a legend, or for one gauge). Keep the names short: they have the open part of the circle for room. The legend can then show just the bands (give them a label).

Can I change the colour of a gauge's needle?

Yes: needle: { color: "#0f766e" } instead of needle: true. color: "band" gives the needle the colour of the band its value is in, color: "series" the series colour; that also tells the needles of several gauges apart. Without a colour the needle has the text colour of the theme (CSS: .plotissimo .pl-gauge-needle { fill: … }).

The hub in the middle takes the needle's colour (with one needle); hubColor gives it its own, with the same values (several needles share one hub, which takes the first hubColor given): needle: { color: "band", hubColor: "#111827" }. In CSS: .plotissimo .pl-gauge-hub { fill: …; stroke: … } (the stroke is the thin ring around it, the background colour by default).

Where does a full-circle gauge start?

At startAngle (0 is 12 o'clock). A thin line across the ring marks it, and the value arc starts square exactly there; only its end is round (rounded). The end of the scale lies on its start, so it gets no tick label of its own: 0% marks both. With startAngle: -90, endAngle: 270 it starts at 9 o'clock.

Can a gauge show the value of its target?

Yes, with targetLabel: true: the target's value ("85%") is shown at its marker, in line with the tick labels; a tick whose label it would overlap is left out (without tick labels: just outside the ring). Your own text: targetLabel: "Goal" or targetLabel: (target) => \Goal ${target}%``. It is off by default; on hover the marker always shows "Target: …".

series: [{ value: 72, unit: "%", target: 85, targetLabel: true }]

Bubble

How does selecting bubbles work?

A click on a bubble selects it (it gets its outline and label, and comes to the front) and deselects any other. A second click on it, or a click anywhere else on the chart or the page, deselects it; its label (shown on hover by default) then hides too, until the pointer has left the bubble. Enter and Space do the same for keyboard users. With selectable: "multiple" a click selects or deselects one bubble and several can be selected; selectable: false turns it off. chart.on("selectionChange", (e) => e.selected) gives the selected data points.

How do I shade the plot area in diagonal zones (low / medium / high)?

With polygon zones in plotArea.fills: the points are data values (x, y), so the zones follow the scales. For two scores from 0 to 100, with the boundaries where x + y is 50 and 100:

plotArea: {
	fills: [
		{ points: [[0, 0], [0, 50], [50, 0]], color: "#fee2e2", opacity: 1, label: "Low", labelAt: [15, 15] },
		{ points: [[0, 50], [0, 100], [100, 0], [50, 0]], color: "#fef3c7", opacity: 1, label: "Medium", labelAt: [40, 35] },
		{ points: [[0, 100], [100, 100], [100, 0]], color: "#dcfce7", opacity: 1, label: "High", labelAt: [85, 85] },
	],
},

The zones lie behind the gridlines and the data. Without opacity a zone is drawn at 0.12, a faint tint of a strong colour (color: "#ef4444" gives a light red); pale colours like these need opacity: 1, or they are almost white. See the guide's plot area section for rectangles, ellipses, gradients and free paths.

How do I make bubbles more or less transparent?

With the option opacity, from 0 (only the outline) to 1 (solid); the default is 0.55. On the series for all its bubbles, or on a data point for one bubble (it wins over the series):

series: [{ name: "Suppliers", opacity: 0.25, data: [
	{ label: "Acme", x: 80, y: 62, size: 120, opacity: 0.9 },   // this one stands out
	{ label: "Steel Works", x: 45, y: 70, size: 300 },
] }]

Hover and a selection make a bubble stronger (at 0.55: 0.8 and 0.9). The outline keeps its full colour; for a lighter outline too, use CSS: .plotissimo .pl-bubble { stroke-opacity: 0.5; }.

Can I put a picture (JPG, PNG) behind the plot area?

Yes, as a zone with an image in plotArea.fills. Without bounds it covers the whole plot area; with bounds, points or an ellipse it is clipped to that zone:

plotArea: {
	fills: [
		{ image: { href: "img/map.jpg", alt: "the region" } },                        // the whole plot area
		{ points: [[0, 100], [100, 100], [100, 0]], image: "logo.png", fit: "contain", opacity: 0.25 },
	],
},

fit is "cover" (default: the zone is filled, the edges of the image cut off), "contain" (the whole image) or "stretch". Keep the picture calm and light, or the bubbles and gridlines get lost on it; opacity helps. A download (PNG or SVG) embeds the images (one from another site needs CORS there); toSVG() keeps their full address. Patterns are not an option yet.

Histogram

How do I compare two histograms, e.g. this year and last year?

Give both series the same binWidth and range, so their bins line up. By default they overlap and their bars are see-through where they do; layout: "side" on both puts them side by side in each bin (a lane each). The hover box names the series: "2026, 50 to 60: #32".

Why do my histogram's labels not show?

With more than 20 bins, labels: true leaves the labels out (a row of tiny numbers); labels: "all" shows them on every bin where the label is no wider than its bar.

Can a histogram lie on its side?

Yes: chart option orientation: "horizontal" puts the bins up the left side (the lowest at the bottom) and the counts along the bottom. Put the bins' axis title on axes.left.

Box plot

Can I give a box plot statistics of my own, e.g. from a report, and what does the hover box show then?

Give min, q1, median, q3, max (and optionally outliers, mean, count) instead of values. The box, the whiskers and the hover box show your numbers as they are ("median 60, quartiles 52 to 68, range 31 to 84, 1 outlier"; with a count also "212 values"); nothing is computed or checked. whisker does not apply (your min and max are the whiskers' ends), outliers: false still hides your outliers, mean: true shows a ◆ only where you give a mean, and points: true draws nothing (there are no values).

data: [{ label: "2023", min: 31, q1: 52, median: 60, q3: 68, max: 84, outliers: [12], mean: 59 }]

Can a form warn before someone adds a value that is a massive outlier?

Yes, in your form, before it saves: the click on a box gives its statistics (c.datum.q1, c.datum.q3, ...). A value more than 3 × the box's height (the IQR) beyond the box is an extreme outlier (Tukey's "far out"); the chart's scale (chart.scales.y.min / .max) tells whether the axis would have to stretch for it, which squeezes every box. Show a warning and save only on a second click:

const iqr = c.datum.q3 - c.datum.q1;
const extreme = value < c.datum.q1 - 3 * iqr || value > c.datum.q3 + 3 * iqr;
const stretches = value < chart.scales.y.min || value > chart.scales.y.max;
if (extreme && !confirmed) {
	warning.textContent = `${value} is far outside the other scores: an extreme outlier.`
		+ (stretches ? " The axis will stretch to show it." : "") + " Save anyway?";
	confirmed = true;   // the next Save saves it; changing the value asks again
	return;
}

The playground page boxplot.html does this in "Click opens a form" (try 400).

Population pyramid

Is a population pyramid a kind of histogram?

No, it is its own chart type, PyramidChart: a histogram counts raw values (one age per person), a pyramid shows counts per group that you already have (from a census or an HR report), as bars back to back around zero. The first series goes to the left, the others to the right (side chooses), the first group at the bottom.