# Stacked bar chart with accumulate-relative stack mode (Chartist example)

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

`src/main.ts`:

```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'
  }
);
```

`index.html`:

```html
<!doctype html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script type="module" src="/src/main.ts"></script>
  </head>
  <body>
    <div id="chart" style="height: 50vh"></div>
  </body>
</html>
```

The same chart with the 1.x classes (`src/main.classic.ts`):

```ts
import 'chartist/styles.css';
import { BarChart } from 'chartist';

new BarChart(
  '#chart',
  {
    labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday'],
    series: [
      [5, 4, -3, -5],
      [5, -4, 3, -5]
    ]
  },
  {
    stackBars: true,
    stackMode: 'accumulate-relative'
  }
);
```
