Column chart

Each row of the table is a column. The number is shown above it.

Apples picked
thousands
Spring 58
Summer 72
Autumn 70
Winter 91
HTML
<figure data-chart="column">
	<figcaption><b>Apples picked</b><br><span>thousands</span></figcaption>
	<table>
		<tbody>
			<tr><th>Spring</th><td>58</td></tr>

			<!-- …one row per column-->
		</tbody>
	</table>
</figure>

Numbers inside the columns

If you want each number inside its column, at the top, add data-chart-labels="inside". If you want it at the bottom of the column or in the middle, see Text. If a column is too short for its number, the number is shown above it.

Spring 58
Summer 72
Autumn 70
Winter 9
HTML
<figure data-chart="column" data-chart-labels="inside"></figure>

Height

The height of a chart is a share of its width, set with data-chart-aspect. The default is 0.38.

On a narrow screen, a chart is never less high than --tablechart-min-height: 200px by default. Below that width, the height stays the same. It can be in px, em or rem, or none for no minimum. On a wide screen, --tablechart-max-height does the same at the top. See Height.

Spring 58
Summer 72
Autumn 70
HTML
<figure data-chart="column" data-chart-aspect="0.6">
	<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>

Below zero

A column with a value below zero hangs down from the baseline, with its number under it. The baseline moves up to make room.

Monthly result
thousands of euros
Jan 12.6
Feb 28.7
Mar -11.7
Apr -36.3
May 19.8
Jun -4.1
HTML
<figure data-chart="column">
	<figcaption><b>Monthly result</b><br><span>thousands of euros</span></figcaption>
	<table>
		<tbody>
			<tr><th>Jan</th><td>12.6</td></tr>
			<tr><th>Feb</th><td>28.7</td></tr>
			<tr><th>Mar</th><td>-11.7</td></tr>
			<tr><th>Apr</th><td>-36.3</td></tr>
			<tr><th>May</th><td>19.8</td></tr>
			<tr><th>Jun</th><td>-4.1</td></tr>
		</tbody>
	</table>
</figure>

With several value columns, each column of a group hangs down or stands up on its own.

Monthly result
thousands of euros
Month 2024 2025
Jan 12.6 -2.6
Feb 28.7 -12.2
Mar -11.7 12.0
Apr -36.3 26.8
May 19.8 -6.9
Jun -4.1 7.5
HTML
<figure data-chart="column">
	<figcaption><b>Monthly result</b><br><span>thousands of euros</span></figcaption>
	<table>
		<thead>
			<tr><th>Month</th><th>2024</th><th>2025</th></tr>
		</thead>
		<tbody>
			<tr><th>Jan</th><td>12.6</td><td>-2.6</td></tr>
			<tr><th>Feb</th><td>28.7</td><td>-12.2</td></tr>
			<tr><th>Mar</th><td>-11.7</td><td>12.0</td></tr>
			<tr><th>Apr</th><td>-36.3</td><td>26.8</td></tr>
			<tr><th>May</th><td>19.8</td><td>-6.9</td></tr>
			<tr><th>Jun</th><td>-4.1</td><td>7.5</td></tr>
		</tbody>
	</table>
</figure>

Grouped columns

If the table has more than one value column, each row is a group, with one column for each value column. The column headers are the names in the legend under the chart.

Apples sold by variety
thousands
Variety 2022 2026
Elstar 118 131
Granny Smith 12 45
Jonagold 140 135
Braeburn 109 121
HTML
<figure data-chart="column">
	<figcaption><b>Apples sold by variety</b><br><span>thousands</span></figcaption>
	<table>
		<thead>
			<tr><th>Variety</th><th>2022</th><th>2026</th></tr>
		</thead>
		<tbody>
			<tr><th>Elstar</th><td>118</td><td>131</td></tr>
			<tr class="granny"><th>Granny Smith</th><td>12</td><td>45</td></tr>
			<tr><th>Jonagold</th><td>140</td><td>135</td></tr>
			<tr><th>Braeburn</th><td>109</td><td>121</td></tr>
		</tbody>
	</table>
</figure>

Each column of a group is a bit lighter than the one before it. If you want to set a colour for each, use a palette. A class on a row styles its whole group, as the Granny Smith does here:

CSS
.granny {
	--tablechart-bar-color: light-dark(#3a6413, #7fb03f);
}

If the numbers are wider than their columns, they all get smaller together, down to half their size. If they still do not fit, the chart has to omit all of them. If you hover over a group of columns (or tap it on a touch device), a tooltip shows all its numbers.

Stacked columns

If the figure has data-chart-stack, the values of a row are shown on top of each other, the first value column at the bottom. Values below zero are stacked down from the baseline. The total of the row is above the column.

Apples sold
thousands
Year Farm shop Market
2023 64 38
2024 71 45
2025 69 57
2026 80 62
HTML
<figure data-chart="column" data-chart-stack>
	<figcaption><b>Apples sold</b><br><span>thousands</span></figcaption>
	<table>
		<thead>
			<tr><th>Year</th><th>Farm shop</th><th>Market</th></tr>
		</thead>
		<tbody>
			<tr><th>2023</th><td>64</td><td>38</td></tr>
			<tr><th>2024</th><td>71</td><td>45</td></tr>
			<tr><th>2025</th><td>69</td><td>57</td></tr>
			<tr><th>2026</th><td>80</td><td>62</td></tr>
		</tbody>
	</table>
</figure>

A number is shown inside its part of the column if it fits. If it does not fit, the chart has to omit it. If you hover over the column (or tap it on a touch device), a tooltip shows all its numbers.

Below zero, the parts of a stack go down from the baseline. The total is the sum of all parts, above the column, or under it if the whole stack is below zero.

Monthly result
thousands of euros
Month Shop Market
Jan 12 -4
Feb 8 -9
Mar -6 3
Apr -14 -7
May 4 -2
Jun 10 5
HTML
<figure data-chart="column" data-chart-stack>
	<figcaption><b>Monthly result</b><br><span>thousands of euros</span></figcaption>
	<table>
		<thead>
			<tr><th>Month</th><th>Shop</th><th>Market</th></tr>
		</thead>
		<tbody>
			<tr><th>Jan</th><td>12</td><td>-4</td></tr>
			<tr><th>Feb</th><td>8</td><td>-9</td></tr>
			<tr><th>Mar</th><td>-6</td><td>3</td></tr>
			<tr><th>Apr</th><td>-14</td><td>-7</td></tr>
			<tr><th>May</th><td>4</td><td>-2</td></tr>
			<tr><th>Jun</th><td>10</td><td>5</td></tr>
		</tbody>
	</table>
</figure>

Columns and a line

If you want a value column as a line over the columns, add data-chart="line" to its header. If a column has data-axis="right", it gets a value axis of its own, on the right. See Combo.

Many columns

With many columns, only the numbers of the largest values are shown, and the names under the chart get smaller or fewer. On a narrow screen, a column chart can be shown as a bar chart. See Many rows.

Scale break

If one column is much taller than the others, a break in the scale shows part of the scale smaller, so the other columns have room. See Scale break.

Elstar 12
Jonagold 15
Braeburn 14
Gala 140
HTML
<figure data-chart="column">
	<table>
		<tbody>
			<tr><th>Elstar</th><td>12</td></tr>
			<tr><th>Jonagold</th><td>15</td></tr>
			<tr><th>Braeburn</th><td>14</td></tr>
			<tr><th>Gala</th><td>140</td></tr>
		</tbody>
	</table>
	<div class="chart-annotations"><span data-annotation="axis-break" data-from="20"></span></div>
</figure>

Axis and gridlines

By default there is no value axis: the numbers on the columns show the values. If you want numbers along the axis, on the left, add data-chart-axis. If you want a light line at each of those numbers, add data-chart-grid. You can add one of them, or both. If you want to add them to every chart, set the axis and grid options to true.

Apples picked
Spring 58
Summer 72
Autumn 70
Winter 41
HTML
<figure data-chart="column" data-chart-axis data-chart-grid>
	<figcaption><b>Apples picked</b></figcaption>
	<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>41</td></tr>
		</tbody>
	</table>
</figure>

If a chart has an axis or gridlines, its scale ends on a number of the axis. If you want to set the scale yourself, add data-chart-scale, such as data-chart-scale="0 100". If you want to change how the axis and gridlines look, see Axes and gridlines.

Next

Annotations add a bracket or a trend arrow to a column chart.