Background
The colour behind a chart, which lighter lines and slices are mixed with.
What uses the background colour
Tablechart measures the background colour behind a chart: the first background that is not transparent, such as that of the page, a card or a section. In Reveal.js, the data-background-color of a slide counts as its background. The chart itself stays transparent.
Each line after the first is lighter than the one before it, and so is each donut slice. The lighter colour is the line or slice colour mixed with the background colour. Borders of scatter markers have that colour too, and so does a number inside a bar, if it has enough contrast. See Numbers inside bars or columns.
If you set a colour for each line or slice with a palette, the background colour is not used for them.
These parts are cut out of the chart, so they show the real background:
- the inside of open points on a line;
- the badge of a bracket or trend arrow;
- the gaps between donut slices;
- the break in a scale.
In this example, the box has gotten a dark background:
.dark {
background: #16323f;
color: #f3efe9;
padding: 1em;
--tablechart-slice-color: #f3efe9;
}
| Juiced | 38.2 |
|---|---|
| Eaten fresh | 18.1 |
| Sold whole | 12.4 |
| Composted | 5.8 |
<figure class="dark" data-chart="donut">
<table>
<tbody>
<tr><th>Juiced</th><td>38.2</td></tr>
<tr><th>Eaten fresh</th><td>18.1</td></tr>
<tr><th>Sold whole</th><td>12.4</td></tr>
<tr><th>Composted</th><td>5.8</td></tr>
</tbody>
</table>
</figure>