Bar labels
API v0.xGlobal: reads the global Chartist, for backwards compatibilityNo SSRchartist-plugin-barlabels@0.0.5Writes each value at the end of its bar.
- Author
- Matt Gibbs
- License
- WTFPL
- Downloads
- 2,585 a month (October 14, 2026)
- Last release
- 2016
- Charts
- Bar
See it run
src/main.ts
import 'chartist/styles.css';
import { barChart } from 'chartist';
import { fromLegacyPlugin } from 'chartist/compat';
// Plugin scripts register on the global `Chartist`.
const { plugins } = Chartist;
barChart(
'#chart',
{
labels: ['Apples', 'Pears', 'Plums', 'Cherries'],
series: [[42, 28, 35, 51]]
},
{
chartPadding: { top: 25 },
plugins: [fromLegacyPlugin(plugins.ctBarLabels())]
}
); 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-barlabels@0.0.5/dist/chartist-plugin-barlabels.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.ctBarLabels())]
});
</script>