Lines and points

These variables set the lines of a line chart or an area chart, and their points. The colours of the lines are on Colours. Which line has which point and pattern is on Line.

CSS
.bold-lines {
	--tablechart-series-width: 3px;
	--tablechart-series-dash: 10 6;
	--tablechart-series-dash-dot: 10 6 0 6;
	--tablechart-point-color: light-dark(#c8500a, #ffb366);
}
Apples per tree
Year North South East
2016 41 30 22
2019 58 39 35
2022 77 52 41
2025 105 61 70
HTML
<figure class="bold-lines" data-chart="line" data-chart-legend>
	<figcaption><b>Apples per tree</b></figcaption>
	<table>
		<thead>
			<tr><th>Year</th><th>North</th><th data-line="dashed">South</th><th data-line="dash-dot">East</th></tr>
		</thead>
		<tbody>
			<tr><th>2016</th><td>41</td><td>30</td><td>22</td></tr>
			<tr><th>2019</th><td>58</td><td>39</td><td>35</td></tr>
			<tr><th>2022</th><td>77</td><td>52</td><td>41</td></tr>
			<tr><th>2025</th><td>105</td><td>61</td><td>70</td></tr>
		</tbody>
	</table>
</figure>
Variable Sets
--tablechart-series-width The width of a line: 2px by default
--tablechart-series-dash The pattern of a dashed line, in pixels: 6 4 by default
--tablechart-series-dot The pattern of a dotted line, in pixels: 0 4 by default
--tablechart-series-dash-dot The pattern of a dash-dot line, in pixels: 6 4 0 4 by default
--tablechart-point-color The points on a line, also in the legend and the tooltip: the colour of the line by default
--tablechart-area-color / -opacity / -fade The fill under a line, in an area chart

Baseline and connectors

The baseline and the connectors between waterfall steps each have a colour, width and opacity. --tablechart-connector-dash sets the dashes.

CSS
.dotty {
	--tablechart-connector-width: 2.5px;
	--tablechart-connector-dash: 0 6;
	--tablechart-connector-opacity: 1;
	--tablechart-baseline-width: 2px;
	--tablechart-baseline-opacity: 1;
}
/* A dash of 0 with round ends is a dot. */
.dotty .tablechart-connector {
	stroke-linecap: round;
}
Picked 74.5
Windfalls 28.2
Bruised -16.1
Peelings -13.3
Pressed 73.3
HTML
<figure class="dotty" data-chart="waterfall">
	<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 data-kind="total"><th>Pressed</th><td>73.3</td></tr>
		</tbody>
	</table>
</figure>

Badges

The badge of an annotation, such as a bracket, a trend arrow or a note, is a box with rounded corners by default. These variables set its corners, padding and background. For an ellipse, set the corners to 50%, with more padding at the sides, so the text stays clear of the curve:

CSS
.ellipse {
	--tablechart-badge-radius: 50%;
	--tablechart-badge-padding: 0.5em 1.25em;
}
Last season 251.5
This season 279.6
+11%
HTML
<figure class="ellipse" data-chart="column">
	<table>
		<tbody>
			<tr><th>Last season</th><td>251.5</td></tr>
			<tr><th>This season</th><td>279.6</td></tr>
		</tbody>
	</table>
	<div class="chart-annotations"><span data-annotation="bracket">+11%</span></div>
</figure>

Bar width

A bar is never wider than --tablechart-bar-max: 60px by default. It can be in px, % of the chart width, em or rem, or none for no maximum.

Spring 58
Summer 72
Autumn 70
Winter 91
HTML
<figure data-chart="column" style="--tablechart-bar-max: 24px">
	<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>
			<tr><th>Winter</th><td>91</td></tr>
		</tbody>
	</table>
</figure>

Height

A chart gets higher with its width. If you want it to stop at a certain height, set --tablechart-max-height. Above that height, the chart only gets wider. If you want one height at every width, such as in a dashboard tile, set --tablechart-height. Both can be in px, em or rem.

If the rows of a bar chart need more room than the maximum, the chart gets that room.

The height is the width times data-chart-aspect, between the minimum and the maximum. So these three values set the shape of a chart at every width. In this example, a chart narrower than 320px is taller than it is wide. Between 320px and 480px it is square. Wider than 480px, it is wider than it is high, and it does not get higher.

Spring 58
Summer 72
Autumn 70
Winter 91
HTML
<figure data-chart="column" data-chart-aspect="1" style="--tablechart-min-height: 320px; --tablechart-max-height: 480px">
	<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>
			<tr><th>Winter</th><td>91</td></tr>
		</tbody>
	</table>
</figure>
Spring 58
Summer 72
Autumn 70
Winter 91
HTML
<figure data-chart="column" style="--tablechart-max-height: 240px">
	<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>
			<tr><th>Winter</th><td>91</td></tr>
		</tbody>
	</table>
</figure>

Charts side by side

If the names under one chart take two lines and those under the chart next to it take one, the baselines of the charts do not line up. If you want them to line up, add data-chart-group to an element around the charts. Charts on one line of the page then get a row of names of the same height. Charts on another line have their own height, so this also works in a grid that wraps.

If the charts are in different places, add data-chart-group="sales" to each, with the same name.

Elstar from the orchard 58
Jonagold from the hill 72
Cox from the old trees 70
2024 41
2025 52

If the numbers of the charts can be compared, also add data-chart-group-scale. All charts of the group then use one scale, from the lowest to the highest value of them all. Charts on one line of the page also get the same plot height, so the same value is the same height. If the units of the charts differ, such as euros and percentages, leave it out. A waterfall chart and a chart with a break in its scale keep their own scale.

Elstar
2023 58
2024 72
2025 70
Cox
2024 41
2025 52

Rounded ends

--tablechart-corner-radius rounds the corners of columns, bars and donut slices, in px or em. If one of them needs another value, --tablechart-bar-radius sets it for columns and bars, and --tablechart-slice-radius for slices.

On a column or bar, the end that shows the value gets rounded. The end at the baseline stays square. In a stack, only the outer end of the stack is rounded. A column shorter than the radius gets a smaller radius. A waterfall stays square.

Spring 58
Summer 72
Autumn 70
Winter 91
HTML
<figure data-chart="column" style="--tablechart-corner-radius: 6px">
	<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>
			<tr><th>Winter</th><td>91</td></tr>
		</tbody>
	</table>
</figure>

Rounded slices

--tablechart-corner-radius also rounds the corners of the slices of a donut. A thin slice gets a smaller radius.

Elstar 42
Jonagold 28
Gala 18
Cox 12
HTML
<figure data-chart="donut" style="--tablechart-corner-radius: 6px">
	<table>
		<tbody>
			<tr><th>Elstar</th><td>42</td></tr>
			<tr><th>Jonagold</th><td>28</td></tr>
			<tr><th>Gala</th><td>18</td></tr>
			<tr><th>Cox</th><td>12</td></tr>
		</tbody>
	</table>
</figure>

All variables

Variable Sets
--tablechart-baseline-color / -width / -opacity The baseline
--tablechart-connector-color / -width / -dash / -opacity The connectors between waterfall steps
--tablechart-leader-color / -width / -opacity The line from a donut slice to its number
--tablechart-annotation-color / -width The lines and arrowheads of annotations
--tablechart-break-color / -width / -opacity The lines of a break in the scale
--tablechart-badge-surface / -padding / -radius / -border-width The badge
--tablechart-slice-gap The gap between donut slices, in the units of the plot: 4 by default
--tablechart-bar-max The widest a bar may be: 60px by default
--tablechart-max-height The most height of a chart: none by default
--tablechart-height A fixed height, for the minimum and the maximum at once
--tablechart-corner-radius How round the corners of columns, bars and slices are: 0 by default
--tablechart-bar-radius The same, for columns and bars only
--tablechart-slice-radius The same, for slices only