Chartist

Search

Find a guide, an API entry or an example.

Try

Stacked bar chart with accumulate-relative stack mode

Positive and negative values stacked separately, up and down from zero.

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

barChart(
  '#chart',
  {
    labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday'],
    series: [
      [5, 4, -3, -5],
      [5, -4, 3, -5]
    ]
  },
  {
    stackBars: true,
    stackMode: 'accumulate-relative'
  }
);
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.