Chartist

Search

Find a guide, an API entry or an example.

Try

Stacked bar chart

Three series stacked per quarter, with a plugin that widens every bar.

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

barChart(
  '#chart',
  {
    labels: ['Q1', 'Q2', 'Q3', 'Q4'],
    series: [
      [800000, 1200000, 1400000, 1300000],
      [200000, 400000, 500000, 300000],
      [100000, 200000, 400000, 600000]
    ]
  },
  {
    stackBars: true,
    axisY: {
      labelInterpolationFnc: value => +value / 1000 + 'k'
    }
  }
);
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.