Fill donut
API v0.xGlobal: reads the global Chartist, for backwards compatibilityNo SSRchartist-plugin-fill-donut@0.1.4Draws a copy of the donut behind it, so an animated donut looks filled from the start, and puts HTML labels in or around it. Together they make gauges.
- Author
- moxx
- License
- MIT
- Downloads
- 5,181 a month (October 14, 2026)
- Last release
- 2016
- Charts
- Pie
See it run
src/main.ts
import 'chartist/styles.css';
import './style.css';
import { pieChart } from 'chartist';
import { fromLegacyPlugin } from 'chartist/compat';
// Plugin scripts register on the global `Chartist`.
const { plugins } = Chartist;
// A gauge, as in the plugin's README: 160 of 260 on a ring that leaves a
// gap at the bottom. The second slice is the rest of the scale; it's hidden,
// and the plugin's copy of it, drawn behind, is the track.
pieChart(
'#chart',
{ series: [160, 100] },
{
donut: true,
donutWidth: 20,
startAngle: 210,
total: 260,
showLabel: false,
plugins: [
fromLegacyPlugin(
plugins.fillDonut({
items: [{ content: '<strong>160</strong> mph' }]
})
)
]
}
); Live
Use it on your site
Runs on v2 with chartist/compat. A script: load it after importing chartist/compat, which sets up the global it reads. With the UMD build or a bundler
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/index.min.css">
<script type="module">
import 'https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/compat.min.js';
</script>
<script defer src="https://cdn.jsdelivr.net/npm/chartist-plugin-fill-donut@0.1.4/dist/chartist-plugin-fill-donut.js"></script>
<script type="module">
import { lineChart } from 'https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/index.min.js';
import { fromLegacyPlugin } from 'https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/compat.min.js';
lineChart('#chart', data, {
plugins: [fromLegacyPlugin(Chartist.plugins.fillDonut())]
});
</script>