Skip to content

Export ​

A menu ​

toolbar: true adds a small button. It takes the formats, their labels, the name of the file, an icon, and what to write in the file. The formats are svg, png and csv by default; md and figma are there when you ask for them:

ts
createChart(host, spec, { toolbar: { formats: ['svg', 'png', 'csv', 'md', 'figma'] } });

From code ​

ts
await chart.download('png', 'orders', { title: 'Orders', subtitle: '2026', caption: 'Source: me', background: '#fff', padding: 24, scale: 3 });

const svg = chart.toSVG({ title: 'Orders' });
const png = await chart.toPNG({ scale: 2 });
const csv = chart.toCSV();
const md = chart.toMarkdown();
OptionDoes
title, subtitle, captiontext written in the file only
backgroundthe theme in PNG, transparent in SVG
paddingpixels around the drawing
scalePNG only, 2 by default

Headings, notes, what decorate adds and what your CSS changed are kept; tooltips and buttons are not. PNG files use system fonts, because a browser does not load web fonts inside an image. Cells of a CSV that look like a formula get a quote in front.

Markdown ​

chart.toMarkdown() writes the data of the chart as a Markdown table, under the title of the chart as a heading: the same rows as the CSV, with the figures written as on the chart (its format and locale) and numbers aligned to the right. Paste it in a README, an issue, a wiki or a message to a language model. On a server, without a chart, toMarkdown(spec) from nervure/render does the same.

Figma ​

chart.toSVG({ figma: true }) writes an SVG made to be pasted in Figma, and await chart.copyForFigma() puts it on the clipboard (as image/svg+xml and as text): paste it in a Figma file and it becomes layers you can edit. In the menu, figma copies it, or saves the file when the browser refuses the clipboard.

  • Layers are named after the parts of the chart: axes, series, legend, legend-item Sales, heading… (id and data-name).
  • Text stays text, with its font family, size and weight written on it. A family Figma cannot know, such as system-ui or sans-serif, becomes Inter; set font in the theme to the font you use in Figma.
  • CSS variables and currentColor become the colours they stand for. Halos behind labels are dropped, as Figma draws them over the letters.
  • Nothing is in a foreignObject. Clip paths stay only where a chart needs them (liquid gauge, pictograms, avatars).

Many points ​

A scatter plot with more than 3000 points paints them on a canvas (render: 'auto', or 'canvas' and 'svg' to choose). Axes, legend and labels stay SVG; the tooltip and the click still find the nearest point. In an SVG export the points become a picture (a PNG inside the SVG), drawn at the resolution of the screen; in a PNG export they are drawn as the rest. For a file with real vector points, set render: 'svg': the browser is slower with that many elements, but the file can be edited point by point.