| One | 1 |
|---|---|
| Two | 2 |
| Three | 3 |
| One | 1 |
|---|---|
| Two | 1 |
| Three | 1 |
| One | 1 |
|---|---|
| Two | 2 |
| Three | 3 |
Sometimes you just want a simple graph in a Reveal.js presentation. Simple colors and style, simple markup. Tablechart does that.
Six main types:
| Spring | 70 |
|---|---|
| Summer | 48 |
| Autumn | 62 |
| Spring | 70 |
|---|---|
| Summer | 48 |
| Autumn | 62 |
| Spring | 70 |
|---|---|
| Summer | 48 |
| Autumn | 62 |
| Spring | 70 |
|---|---|
| Summer | 48 |
| Autumn | 62 |
| Spring | 70 |
|---|---|
| Summer | 48 |
| Autumn | 62 |
| Spring | 70 |
|---|---|
| Summer | 48 |
| Autumn | 62 |
And scatter charts, with bubbles and groups:
| Harvest per tree (kg) | Price per kg (€) | Trees | Use | |
|---|---|---|---|---|
| Elstar | 62 | 1.20 | 420 | Eating |
| Jonagold | 75 | 1.05 | 310 | Eating |
| Braeburn | 48 | 1.45 | 180 | Eating |
| Gala | 55 | 1.30 | 260 | Eating |
| Cox | 35 | 1.85 | 120 | Eating |
| Discovery | 30 | 1.75 | 60 | Eating |
| Boskoop | 70 | 0.95 | 200 | Cooking |
| Granny Smith | 40 | 1.60 | 90 | Cooking |
It’s easy
Download the plugin folder and make a reference to it in the Reveal plugin options:
(The CSS file is autoloaded, but you can also load it manually if you want to change it.)
<script src="plugin/tablechart/tablechart.js"></script>
<script>
Reveal.initialize({
plugins: [ Tablechart ]
});
</script>
Or install it with npm (npm i reveal.js-tablechart) and import it:
import Tablechart from 'reveal.js-tablechart';
import 'reveal.js-tablechart/tablechart.css';
Reveal.initialize({
plugins: [ Tablechart ]
});
To create a chart, add a table inside the Tablechart figure markup. The first cell of a row is the label, the second the value.
| Spring | 58 |
|---|---|
| Summer | 72 |
| Autumn | 70 |
<figure class="tablechart" data-chart="column">
<table>
<tbody>
<tr><th>Spring</th><td>58</td></tr>
<tr><th>Summer</th><td>72</td></tr>
<tr><th>Autumn</th><td>70</td></tr>
</tbody>
</table>
</figure>
Or from a JSON source:
<figure class="tablechart" data-chart="column" data-chart-src="assets/data/apples.json">
<figcaption><b>Apples picked</b></figcaption>
</figure>
| 2022 | 91 |
|---|---|
| 2023 | 102 |
| 2024 | 116 |
<figure class="tablechart" data-chart="column">
<figcaption>
<b>Apples per tree</b><br><span>each</span>
</figcaption>
<table>
<tbody>
<tr><th>2022</th><td>91</td></tr>
<tr><th>2023</th><td>102</td></tr>
<tr><th>2024</th><td>116</td></tr>
</tbody>
</table>
</figure>
| 2022 | 91 |
|---|---|
| 2023 | 102 |
| 2024 | 116 |
<figure class="tablechart" data-chart="column">
<table>
<tbody>
<tr><th>2022</th><td>91</td></tr>
<tr><th>2023</th><td>102</td></tr>
<tr><th>2024</th><td>116</td></tr>
</tbody>
</table>
<div class="chart-annotations">
<span data-annotation="trend" data-years="2" data-at="0.5">
<span class="tablechart-caption">Per year</span>
<span>+13%</span>
</span>
</div>
</figure>
Add data-chart-axis and data-chart-grid to any chart but a donut.
| 2022 | 91 |
|---|---|
| 2023 | 102 |
| 2024 | 116 |
<figure class="tablechart" data-chart="column" data-chart-axis data-chart-grid>
<figcaption>
<b>Apples per tree</b><br><span>each</span>
</figcaption>
<table>
<tbody>
<tr><th>2022</th><td>91</td></tr>
<tr><th>2023</th><td>102</td></tr>
<tr><th>2024</th><td>116</td></tr>
</tbody>
</table>
</figure>
A chart with four lines has no room for every number. Point at a year, or tap it, to see its values.
| North | South | East | West | |
|---|---|---|---|---|
| 2016 | 41 | 30 | 22 | 35 |
| 2019 | 58 | 39 | 35 | 37 |
| 2022 | 77 | 52 | 41 | 48 |
| 2025 | 105 | 61 | 70 | 55 |
| Picked | 74.5 |
|---|---|
| Windfalls | 28.2 |
| Bruised | -16.1 |
| Peelings | -13.3 |
| Pressed | 73.3 |
For everything else Tablechart does, see the other demos and the Tablechart documentation.