Tablechart

for Reveal.js: Area charts

Area chart

A line chart with the space under the line filled. The fill fades in while the line builds.

Visitors to the orchard
thousands
2021 12
2022 18
2023 15
2024 24
2025 29
<figure class="tablechart" data-chart="area">
  <figcaption>
    <b>Visitors to the orchard</b><br><span>thousands</span>
  </figcaption>
  <table>
    <tbody>
      <tr><th>2021</th><td>12</td></tr>
      <tr><th>2022</th><td>18</td></tr>
      <tr><th>2023</th><td>15</td></tr>
      <tr><th>2024</th><td>24</td></tr>
      <tr><th>2025</th><td>29</td></tr>
    </tbody>
  </table>
</figure>

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.

Visitors to the orchard
thousands
2021 12
2022 18
2023 15
2024 24
2025 29
<figure class="tablechart" data-chart="area" data-chart-axis data-chart-grid>
  <figcaption>
    <b>Visitors to the orchard</b><br><span>thousands</span>
  </figcaption>
  <table>
    <tbody>
      <tr><th>2021</th><td>12</td></tr>
      <tr><th>2022</th><td>18</td></tr>
      <tr><th>2023</th><td>15</td></tr>
      …
    </tbody>
  </table>
</figure>

Smooth

Add data-chart-shape="smooth" to the figure. The top of each area is a curve through every point. In a stack, each area follows the curve of the one below it.

Visitors to the orchard
thousands
2021 12
2022 18
2023 15
2024 24
2025 29
<figure class="tablechart" data-chart="area" data-chart-shape="smooth">
  <figcaption>
    <b>Visitors to the orchard</b><br><span>thousands</span>
  </figcaption>
  <table>
    <tbody>
      <tr><th>2021</th><td>12</td></tr>
      <tr><th>2022</th><td>18</td></tr>
      <tr><th>2023</th><td>15</td></tr>
      <tr><th>2024</th><td>24</td></tr>
      <tr><th>2025</th><td>29</td></tr>
    </tbody>
  </table>
</figure>

Grow up

Add data-chart-animate="grow" to the figure. The area grows up from zero instead of from left to right. A chart with data-fragment still builds from left to right, because each step adds a point.

Visitors to the orchard
thousands
2021 12
2022 18
2023 15
2024 24
2025 29
<figure class="tablechart" data-chart="area" data-chart-shape="smooth" data-chart-animate="grow">
  <figcaption>
    <b>Visitors to the orchard</b><br><span>thousands</span>
  </figcaption>
  <table>
    <tbody>
      <tr><th>2021</th><td>12</td></tr>
      <tr><th>2022</th><td>18</td></tr>
      <tr><th>2023</th><td>15</td></tr>
      <tr><th>2024</th><td>24</td></tr>
      <tr><th>2025</th><td>29</td></tr>
    </tbody>
  </table>
</figure>

Several areas

Each value column is an area. The areas overlap, so each one is see-through.

Apples per tree
each
North South
2016 41 30
2019 58 39
2022 77 52
2025 105 61

Stacked areas

Add data-chart-stack to the figure. Each area starts on top of the one before it.

Apples sold
thousands
Farm shop Market
2023 64 38
2024 71 45
2025 69 57

Steps

Add data-chart-shape="step" to the figure. Each value is flat across its row, and a number is shown only where the value changes.

Land at the orchard
share of the land, by kind of tree
Apple trees Pear trees
2016 90% 10%
2017 90% 10%
2018 75% 25%
2019 75% 25%
2020 75% 25%
2021 60% 40%
2022 60% 40%
2023 55% 45%
2024 55% 45%
2025 55% 45%

Step by step

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

Visitors to the orchard
thousands
2021 12
2022 18
2023 15
2024 24
2025 29
<figure class="tablechart" data-chart="area" data-chart-shape="smooth" data-fragment>
  <figcaption>
    <b>Visitors to the orchard</b><br><span>thousands</span>
  </figcaption>
  <table>
    <tbody>
      <tr><th>2021</th><td>12</td></tr>
      <tr><th>2022</th><td>18</td></tr>
      <tr><th>2023</th><td>15</td></tr>
      <tr><th>2024</th><td>24</td></tr>
      <tr><th>2025</th><td>29</td></tr>
    </tbody>
  </table>
</figure>

Several areas, step by step

With data-fragment on the figure, each step adds a point to every area.

Apples picked
thousands
North South
2020 42 18
2021 55 26
2022 38 31
2023 61 24
2024 49 35
2025 68 30
<figure class="tablechart" data-chart="area" data-chart-stack data-chart-shape="smooth" data-chart-legend data-fragment>
  <figcaption>
    <b>Apples picked</b><br><span>thousands</span>
  </figcaption>
  <table>
    <thead>
      <tr><th></th><th>North</th><th>South</th></tr>
    </thead>
    <tbody>
      <tr><th>2020</th><td>42</td><td>18</td></tr>
      <tr><th>2021</th><td>55</td><td>26</td></tr>
      …
    </tbody>
  </table>
</figure>

Area by area

Add data-fragment to a column header to show that whole area on a step.

Apples per tree
each
North South
2016 41 30
2019 58 39
2022 77 52
2025 105 61
<figure class="tablechart" data-chart="area">
  <figcaption>
    <b>Apples per tree</b><br><span>each</span>
  </figcaption>
  <table>
    <thead>
      <tr>
        <th></th>
        <th data-fragment>North</th>
        <th data-fragment>South</th>
      </tr>
    </thead>
    <tbody>
      <tr><th>2016</th><td>41</td><td>30</td></tr>
      <tr><th>2019</th><td>58</td><td>39</td></tr>
      …
    </tbody>
  </table>
</figure>

Point by point, area by area

Add data-fragment to every cell. The steps go down each column: one area point by point, then the next.

Apples per tree
each
North South
2016 41 30
2019 58 39
2022 77 52
2025 105 61
<figure class="tablechart" data-chart="area">
  <figcaption>
    <b>Apples per tree</b><br><span>each</span>
  </figcaption>
  <table>
    <thead>
      <tr><th></th><th>North</th><th>South</th></tr>
    </thead>
    <tbody>
      <tr>
        <th>2016</th>
        <td data-fragment>41</td>
        <td data-fragment>30</td>
      </tr>
      <tr>
        <th>2019</th>
        <td data-fragment>58</td>
        <td data-fragment>39</td>
      </tr>
      …
    </tbody>
  </table>
</figure>

That’s it!

For more about area charts, see the Tablechart documentation.