Chartist

Search

Find a guide, an API entry or an example.

Try

Point labels

API v0.xGlobal: reads the global Chartist, for backwards compatibilityNo SSR
chartist-plugin-pointlabels@0.0.6

Writes each value next to its point, so readers see exact numbers without hovering.

Author
Gion Kunz
Source
GitHub · npm
License
WTFPL
Downloads
11,888 a month (October 14, 2026)
Last release
2018
Charts
Line, Bar

See it run

src/main.ts
import 'chartist/styles.css';
import { lineChart } from 'chartist';
import { fromLegacyPlugin } from 'chartist/compat';

// Plugin scripts register on the global `Chartist`.
const { plugins } = Chartist;

lineChart(
  '#chart',
  {
    labels: ['Q1', 'Q2', 'Q3', 'Q4'],
    series: [[12.5, 18.25, 9.75, 21]]
  },
  {
    chartPadding: { top: 30, right: 30, left: 30 },
    // The labels show every value, so the Y axis keeps only its grid.
    axisY: { showLabel: false, offset: 0 },
    plugins: [
      fromLegacyPlugin(
        plugins.ctPointLabels({
          textAnchor: 'middle',
          labelInterpolationFnc: (value: number) => `$${value.toFixed(2)}`
        })
      )
    ]
  }
);
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-pointlabels@0.0.6/dist/chartist-plugin-pointlabels.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.ctPointLabels())]
  });
</script>