HOSTING

Share an Observable Plot chart as a link

Observable Plot draws a chart as SVG in the browser, so a Plot chart fits in one HTML file. Load D3 and Plot from a CDN, put the data in the page, upload the file, and send a link that opens the chart with its tooltips.

4 min read·

An Observable Plot chart is a few lines of JavaScript that need a page to run in. A notebook link only works for people who can open the notebook, and a screenshot drops the tooltips.

One HTML file that loads D3 and Plot from a CDN and holds the data and the Plot.plot() call, hosted at a link, opens the chart on any device.

Put the chart in one file

Create chart.html with this structure:

  • ✓<!doctype html>, <meta charset="utf-8"> and <meta name="viewport" content="width=device-width, initial-scale=1"> in the head.
  • ✓Two script tags, in this order: https://cdn.jsdelivr.net/npm/d3@7.9.0 and https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.17. Plot needs D3 loaded first. Pinning the versions keeps the chart from changing when a new release ships.
  • ✓A container: <div id="chart"></div>.
  • ✓A <script> block after the container that builds the chart and adds it to the page: const chart = Plot.plot({ marks: [Plot.barY(data, { x: "month", y: "signups", tip: true })] }); document.getElementById("chart").append(chart);
  • ✓Plot.plot() returns an SVG element. Nothing shows until you append it to the page.

Keep the data inside the page

Code copied from a notebook often loads data with FileAttachment("data.csv") or d3.csv("data.csv"). FileAttachment only exists inside Observable, and an uploaded page is hosted on its own, so a request for a second file fails and the chart never draws.

Put the rows in the script instead: const data = [{ month: "Jan", signups: 12 }, { month: "Feb", signups: 19 }, { month: "Mar", signups: 7 }]; Tested on Plot 0.6.17 with D3 7.9.0 in Chrome: that array drew three bars.

Data that already lives at a public URL which allows cross-origin requests can stay remote: const data = await d3.csv("https://..."), inside a <script type="module"> block.

Upload it and send the link

Drag the .html file onto the FileShare Pro dashboard and copy the link. The chart draws when the page opens. Tooltips from tip: true work as they did locally, and viewers need no account.

If the page is blank once hosted, open the browser console. "Plot is not defined" means a script tag is missing or comes after your chart code; "FileAttachment is not defined" or a failed request for a .csv or .json file means data was left outside the page. Why an AI page works in chat but breaks when hosted covers charts an assistant wrote.

Turn on comments and viewers can leave a note on the page after typing a name. When the numbers change, upload the new file over the old one and the link stays the same: updating a shared link without changing it.

Other chart libraries: D3, Vega-Lite, Highcharts, ECharts, Chart.js, Plotly, Google Charts.

Frequently asked

How do I share an Observable Plot chart without a web server?

Put script tags for D3 and Plot from a CDN, a container, your data as a JavaScript array, and a Plot.plot() call appended to the container into one HTML file. Upload it to a host that serves HTML as a web page and send the link.

Why is my Plot chart blank after I copied it out of a notebook?

Notebook code often reads data with FileAttachment, which only exists inside Observable. Replace it with the rows written into the script, or with d3.csv() pointed at a public https:// address that allows cross-origin requests.

Do viewers need an Observable account?

No. The page loads Plot from a public CDN, and anyone with the link can open it.

Is it free?

Yes. The free plan hosts up to 50 files of up to 100 MB each, with view counts and comments included. Password-protected links are on Pro.

Got a page to share?

Drop the file, copy the link — live in seconds, free plan included.

Start sharing free