Tablechart

for Reveal.js: Scatter charts

Scatter chart

Each row is a marker. The first value column is the position across, the second the position up. Their headers are the titles of the axes.

Harvest and price per variety
Harvest per tree (kg) Price per kg (€)
Elstar 62 1.20
Jonagold 75 1.05
Braeburn 48 1.45
Gala 55 1.30
Cox 35 1.85
Discovery 30 1.75
<figure class="tablechart" data-chart="scatter">
  <figcaption><b>Harvest and price per variety</b></figcaption>
  <table>
    <thead>
      <tr>
        <th></th>
        <th>Harvest per tree (kg)</th>
        <th>Price per kg (€)</th>
      </tr>
    </thead>
    <tbody>
      <tr><th>Elstar</th><td>62</td><td>1.20</td></tr>
      <tr><th>Jonagold</th><td>75</td><td>1.05</td></tr>
      …
    </tbody>
  </table>
</figure>

Bubbles

A third value column sets the size of each marker: its area matches the value.

Harvest, price and number of trees
Harvest per tree (kg) Price per kg (€) Trees
Elstar 62 1.20 420
Jonagold 75 1.05 310
Braeburn 48 1.45 180
Gala 55 1.30 260
Cox 35 1.85 120
Discovery 30 1.75 60
<figure class="tablechart" data-chart="scatter">
  <figcaption>
    <b>Harvest, price and number of trees</b>
  </figcaption>
  <table>
    <thead>
      <tr>
        <th></th>
        <th>Harvest per tree (kg)</th>
        <th>Price per kg (€)</th>
        <th>Trees</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th>Elstar</th>
        <td>62</td>
        <td>1.20</td>
        <td>420</td>
      </tr>
      …
    </tbody>
  </table>
</figure>

Groups

Add data-group to the header of a column with names. Each group has its own colour, shape and entry in the legend.

Eating and cooking apples
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
Bramley 70 0.95 140 Cooking
.scattergroups {
    --tablechart-color-1: #4f9fd0;
    --tablechart-color-2: #e0a35b;
}

Axes and gridlines

data-chart-scale-x and data-chart-scale set the axes: two numbers for where they start and end, or more for the numbers along them. data-chart-grid adds gridlines.

From zero
Harvest per tree (kg) Price per kg (€)
Elstar 62 1.20
Jonagold 75 1.05
Braeburn 48 1.45
Gala 55 1.30
Cox 35 1.85
Discovery 30 1.75
<figure class="tablechart" data-chart="scatter" data-chart-grid data-chart-scale-x="0 100" data-chart-scale="0 0.5 1 1.5 2">
  <figcaption><b>From zero</b></figcaption>
  <table>
    <thead>
      <tr>
        <th></th>
        <th>Harvest per tree (kg)</th>
        <th>Price per kg (€)</th>
      </tr>
    </thead>
    <tbody>
      <tr><th>Elstar</th><td>62</td><td>1.20</td></tr>
      <tr><th>Jonagold</th><td>75</td><td>1.05</td></tr>
      …
    </tbody>
  </table>
</figure>

That’s it!

For more about scatter charts, see the Tablechart documentation.