Skip to content
Sections
Fiesta

chart-bar

Display The small pieces of vocabulary a screen is assembled from: status, identity, progress, data tables and charts, and the one alert shape.

A bar chart shows named categories as bars: one series of values that are zero or higher. It is a table, so screen readers get the names and numbers; the bars are decoration.

Each example is live, but its links go nowhere. HTML shows the markup to copy.

Tickets by source

Preview
<div rst-box-head>
  <h2 id="sources-h">Tickets by source</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="sources-h" aria-describedby="sources-d">
    <p rst-chart-desc id="sources-d">Most tickets sold online, and none through the newsletter yet.</p>
    <div rst-table-scroll tabindex="0" role="region" aria-labelledby="sources-h">
      <table rst-table="bars" aria-labelledby="sources-h" aria-describedby="sources-d">
        <thead>
          <tr>
            <th scope="col">Source</th>
            <th scope="col">
              <span class="rst-sr-only">Bar</span>
            </th>
            <th scope="col" rst-num>Tickets</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th scope="row">Online</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="1000" height="1"/></svg>
            </td>
            <td rst-num>412</td>
          </tr>
          <tr>
            <th scope="row">Box office</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="572.8" height="1"/></svg>
            </td>
            <td rst-num>236</td>
          </tr>
          <tr>
            <th scope="row">Partners</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="237.9" height="1"/></svg>
            </td>
            <td rst-num>98</td>
          </tr>
          <tr>
            <th scope="row">Newsletter</th>
            <td rst-table-bar>
              <svg viewBox="0 0 1000 1" preserveAspectRatio="none" aria-hidden="true" focusable="false"><rect width="0" height="1"/></svg>
            </td>
            <td rst-num>0</td>
          </tr>
        </tbody>
      </table>
    </div>
  </figure>
</div>

No data

A chart with nothing to draw says so in one sentence.

Preview
<div rst-box-head>
  <h2 id="sources-h">Tickets by source</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="sources-h">
    <p rst-chart-empty>No tickets sold yet.</p>
  </figure>
</div>