Bar
Bars laid sideways, for long names.
Bar chart
Each row of the table is a bar. The number is shown after it. The names are shown to the left of the bars, where a long name has more room than under a column. If a name is still too long, it wraps onto a second line. See Long names.
thousands of litres
| Bramley seedling | 31.4 |
|---|---|
| Cox’s orange pippin | 27.8 |
| Egremont russet | 18.2 |
| Discovery | 12.6 |
| Worcester pearmain | 9.1 |
<figure data-chart="bar">
<figcaption><b>Juice pressed by variety</b><br><span>thousands of litres</span></figcaption>
<table>
<tbody>
<tr><th>Bramley seedling</th><td>31.4</td></tr>
<tr><th>Cox’s orange pippin</th><td>27.8</td></tr>
<tr><th>Egremont russet</th><td>18.2</td></tr>
<tr><th>Discovery</th><td>12.6</td></tr>
<tr><th>Worcester pearmain</th><td>9.1</td></tr>
</tbody>
</table>
</figure>
Numbers inside the bars
If you want each number inside its bar, at the end, add data-chart-labels="inside". If you want it at the start of the bar or in the middle, see Text. If a bar is too short for its number, the number is shown after it.
| Bramley seedling | 31.4 |
|---|---|
| Cox’s orange pippin | 27.8 |
| Egremont russet | 18.2 |
| Discovery | 12.6 |
| Worcester pearmain | 9.1 |
<figure data-chart="bar" data-chart-labels="inside"></figure>
Long names
A name beside a bar takes at most 40% of the width of the chart. A longer name wraps onto more lines, and the chart gets taller if it needs to. If you want to change the width, set --tablechart-name-max, such as 30%.
A long word is hyphenated if the page has a lang attribute, such as lang="en".
Or give the row a short name for the chart with data-short, such as <th data-short="Cox">Cox’s Orange Pippin</th>. The table, and so a screen reader, keeps the full name. See Many rows.
Below zero
A bar with a value below zero goes to the left of the zero line, with its number before it.
thousands of euros
| Jan | 12.6 |
|---|---|
| Feb | 28.7 |
| Mar | -11.7 |
| Apr | -36.3 |
| May | 19.8 |
| Jun | -4.1 |
<figure data-chart="bar">
<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 bar of a group goes left or right on its own.
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 |
<figure data-chart="bar">
<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 bars
If the table has more than one value column, each row is a group, with one bar for each value column. The column headers are the names in the legend under the chart.
thousands
| Variety | 2022 | 2026 |
|---|---|---|
| Elstar | 118 | 131 |
| Granny Smith | 12 | 45 |
| Jonagold | 140 | 135 |
| Braeburn | 109 | 121 |
<figure data-chart="bar">
<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><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>
Stacked bars
If the figure has data-chart-stack, the values of a row are shown one after the other in one bar, the first value column on the left. Values below zero are stacked to the left of the zero line. The total of the row is after the bar.
thousands
| Variety | Farm shop | Market |
|---|---|---|
| Elstar | 64 | 38 |
| Granny Smith | 12 | 21 |
| Jonagold | 71 | 45 |
| Braeburn | 52 | 30 |
<figure data-chart="bar" data-chart-stack>
<figcaption><b>Apples sold</b><br><span>thousands</span></figcaption>
<table>
<thead>
<tr><th>Variety</th><th>Farm shop</th><th>Market</th></tr>
</thead>
<tbody>
<tr><th>Elstar</th><td>64</td><td>38</td></tr>
<tr><th>Granny Smith</th><td>12</td><td>21</td></tr>
<tr><th>Jonagold</th><td>71</td><td>45</td></tr>
<tr><th>Braeburn</th><td>52</td><td>30</td></tr>
</tbody>
</table>
</figure>
A number is shown inside its part of the bar if it fits. If it does not fit, the chart has to omit it. If you hover over the bar (or tap it on a touch device), a tooltip shows all its numbers.
Below zero, the parts of a stack go left from the zero line. The total is the sum of all parts, after the bar, or before it if the whole stack is below zero.
thousands of euros
| Month | Shop | Market |
|---|---|---|
| Jan | 12 | -4 |
| Feb | 8 | -9 |
| Mar | -6 | 3 |
| Apr | -14 | -7 |
| May | 4 | -2 |
| Jun | 10 | 5 |
<figure data-chart="bar" 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>
Scale break
If one bar is much longer than the others, a break in the scale shows part of the scale smaller, so the other bars have room. See Scale break.
| Bramley seedling | 140 |
|---|---|
| Cox’s orange pippin | 15 |
| Egremont russet | 14 |
| Discovery | 12 |
<figure data-chart="bar">
<table>
<tbody>
<tr><th>Bramley seedling</th><td>140</td></tr>
<tr><th>Cox’s orange pippin</th><td>15</td></tr>
<tr><th>Egremont russet</th><td>14</td></tr>
<tr><th>Discovery</th><td>12</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 bars show the values. If you want numbers along the axis, under the bars, 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.
thousands of litres
| Bramley seedling | 31.4 |
|---|---|
| Cox’s orange pippin | 27.8 |
| Egremont russet | 18.2 |
| Discovery | 12.6 |
| Worcester pearmain | 9.1 |
<figure data-chart="bar" data-chart-axis data-chart-grid>
<figcaption><b>Juice pressed by variety</b><br><span>thousands of litres</span></figcaption>
<table>
<tbody>
<tr><th>Bramley seedling</th><td>31.4</td></tr>
<tr><th>Cox’s orange pippin</th><td>27.8</td></tr>
<tr><th>Egremont russet</th><td>18.2</td></tr>
<tr><th>Discovery</th><td>12.6</td></tr>
<tr><th>Worcester pearmain</th><td>9.1</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
For short names, a column chart uses less height.