Ir para o conteúdo
Secções
Fiesta

chart-bar

Apresentação As peças pequenas de vocabulário com que se monta um ecrã: estado, identidade, progresso, tabelas de dados e gráficos, e a única forma de aviso.

Um gráfico de barras mostra categorias com nome em forma de barras: uma só série de valores de zero ou mais. É uma tabela, por isso os leitores de ecrã recebem os nomes e os números; as barras são decoração.

Cada exemplo funciona de verdade, mas as suas ligações não levam a lado nenhum. HTML mostra a marcação para copiar.

Bilhetes por origem

Pré-visualização
<div rst-box-head>
  <h2 id="sources-h">Bilhetes por origem</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="sources-h" aria-describedby="sources-d">
    <p rst-chart-desc id="sources-d">A maioria dos bilhetes foi vendida online e, pela newsletter, nenhum até agora.</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">Origem</th>
            <th scope="col">
              <span class="rst-sr-only">Barra</span>
            </th>
            <th scope="col" rst-num>Bilhetes</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">Bilheteira</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">Parceiros</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>

Sem dados

Um gráfico sem nada para desenhar di-lo numa frase.

Pré-visualização
<div rst-box-head>
  <h2 id="sources-h">Bilhetes por origem</h2>
</div>
<div rst-card>
  <figure rst-chart aria-labelledby="sources-h">
    <p rst-chart-empty>Ainda não foi vendido nenhum bilhete.</p>
  </figure>
</div>