Chartist

Search

Find a guide, an API entry or an example.

Try

Simple pie chart

Three slices, each labelled with its share of the total.

src/main.ts
import 'chartist/styles.css';
import { pieChart } from 'chartist';

const data = {
  series: [5, 3, 4]
};

pieChart('#chart', data, {
  labelInterpolationFnc: value =>
    Math.round((+value / data.series.reduce((a, b) => a + b)) * 100) + '%'
});
Live
Open in the playgroundView as MarkdownSwitch to 1.x above the code to see the same chart written with the Chartist 1.x classes.