HOSTING

Share a Chart.js chart as a link

A Chart.js chart is a canvas on a web page, so it fits in one HTML file. Load Chart.js from a CDN, put the data inside the page, upload the file, and send a link that opens the interactive chart in any browser.

4 min read·

Chart.js draws on a <canvas>, and the hover tooltips and clickable legend only work in a browser. A screenshot drops them. A project folder with app.js and a data file needs the recipient to open it locally, and a fetch() for a local file is blocked when a page is opened from disk.

One HTML file with the data inside it, hosted at a link, opens the working chart on any device.

Put the chart in one file

Create chart.html with this structure:

  • ✓<!doctype html> and <meta charset="utf-8"> in the head.
  • ✓<script src="https://cdn.jsdelivr.net/npm/chart.js@4.6.1/dist/chart.umd.min.js"></script> to load Chart.js. Pinning the version keeps the chart from changing when a new release ships.
  • ✓A canvas inside a sized wrapper, such as <div style="max-width:720px"><canvas id="chart"></canvas></div>. Chart.js is responsive by default and takes its size from the wrapper.
  • ✓A <script> block after the canvas: new Chart(document.getElementById("chart"), { type: "bar", data: { labels: [...], datasets: [{ label: "Signups", data: [...] }] } }).
  • ✓Projects built with npm and import Chart from "chart.js" need a bundler. Swap the import for the CDN script tag above, or build to a single file: sharing a Vite app as a single HTML file.

Move the data inside the page

A chart that calls fetch("data.json") requests a second file. An uploaded page is hosted on its own, so that request fails and the canvas stays blank.

Assign the data to a variable in the script block, const rows = [ … ], and build labels and datasets from it. For CSV, paste the rows into <script type="text/csv" id="data">…</script> and split document.getElementById("data").textContent by lines and commas.

Data that already lives at a public URL which allows cross-origin requests can stay as a fetch() with the full https:// address.

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, legend toggles and animations work as they did locally, and viewers need no account.

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

Collect feedback and update the chart

Turn on comments and viewers can leave a note on the page after typing a name. The view count shows whether the people you sent it to have opened it.

When the numbers change, upload the new file over the old one. The link stays the same and the previous version is kept in history: updating a shared link without changing it.

Using D3 instead? See sharing a D3.js chart as a link. Charts made in Python: sharing a Plotly chart as a link.

Frequently asked

How do I share a Chart.js chart without a web server?

Put a script tag that loads Chart.js from a CDN, a canvas, your chart code and the data into one HTML file, upload it to a host that serves HTML as a web page, and send the link.

Why is my Chart.js chart blank after upload?

Usually the data is fetched from a file that was not uploaded, or the Chart.js script tag is missing. Put the data inside the page and load Chart.js from a CDN before your chart code.

Do tooltips and legend clicks still work?

Yes. The page runs the same JavaScript in the viewer's browser as it did on your computer.

Can I put several charts on one page?

Yes. Add one canvas per chart, each with its own id, and create a new Chart for each.

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