Tablechart

for Reveal.js: Waterfalls

Steps and totals

Rows with data-kind="total" start at the baseline. The other rows are steps up or down from the running total.

What happened to the crop
thousands of apples
Picked 74.5
Windfalls 28.2
Pressed 102.7
<tr data-kind="total"><th>Picked</th><td>74.5</td></tr>
<tr><th>Windfalls</th><td>28.2</td></tr>
<tr data-kind="total"><th>Pressed</th><td>102.7</td></tr>

Axis and gridlines

Add data-chart-axis for the numbers along the value axis, and data-chart-grid for a line at each of them. The scale then ends on a number of the axis.

What happened to the crop
thousands of apples
Picked 74.5
Windfalls 28.2
Bruised -16.1
Peelings -13.3
Late pick 4.9
Pressed 78.3
<figure class="tablechart" data-chart="waterfall" data-chart-axis data-chart-grid>
  <figcaption>
    <b>What happened to the crop</b><br>
    <span>thousands of apples</span>
  </figcaption>
  <table>
    <tbody>
      <tr data-kind="total"><th>Picked</th><td>74.5</td></tr>
      <tr><th>Windfalls</th><td>28.2</td></tr>
      <tr><th>Bruised</th><td>-16.1</td></tr>
      …
    </tbody>
  </table>
</figure>

Totals are not calculated

See that the last column does not line up? That is not Tablechart. That is your data. Tablechart just takes your values, it does not check if those add up correctly. The console will show a warning if there is a mismatch, because it might be hard to see it in the chart itself.

A shorter bridge
thousands of apples
Picked 74.5
Windfalls 28.2
Bruised -16.1
Peelings -13.3
Pressed 67.8

Numbers

If a bar is tall enough, its number is shown inside it. If not, the number is shown next to it.

Trees in the orchard
thousands
In spring 74.5
Planted 1.2
Lost to frost -0.5
Grafted 0.8
In autumn 76.0

Step by step

Add data-fragment to the figure to show one column per step.

What happened to the crop
thousands of apples
Picked 74.5
Windfalls 28.2
Bruised -16.1
Peelings -13.3
Late pick 4.9
Pressed 78.3
<figure class="tablechart" data-chart="waterfall" data-fragment>
  <figcaption>
    <b>What happened to the crop</b><br>
    <span>thousands of apples</span>
  </figcaption>
  <table>
    <tbody>
      <tr data-kind="total"><th>Picked</th><td>74.5</td></tr>
      <tr><th>Windfalls</th><td>28.2</td></tr>
      <tr><th>Bruised</th><td>-16.1</td></tr>
      <tr><th>Peelings</th><td>-13.3</td></tr>
      <tr><th>Late pick</th><td>4.9</td></tr>
      <tr data-kind="total"><th>Pressed</th><td>78.3</td></tr>
    </tbody>
  </table>
</figure>