___ _ ___ ___ _ | _ (_)__ ___/ __| _ \/_\ | _/ / _/ _ \__ \ _/ _ \ |_| |_\__\___/___/_|/_/ \_\ A PicoSSG tool

Charts

PicoSPA Charts are the simplest and least energy consuming charts you can get. See bar.css, this is all that is needed for making a bar chart out of a table.

All charts are just CSS-styled <table>s.

<link href="https://cdn.jsdelivr.net/npm/@pic0/spa@2026.1.12/_dist/chart.css" rel="stylesheet">

<table class="picospa-chart bar" style="width: 100%;">
    <tbody style="height: 6em;">
        <tr><th></th><td style="--percent: 50%">50</td></tr>
        <tr><th></th><td style="--percent: 75%">75</td></tr>
        <tr><th></th><td style="--percent: 99%">99</td></tr>
    </tbody>
</table>

The code above will generate this very simple bar chart. Very often this all that is needed.

Fifty50
75
99

The Structure

A table is semantically ideal, let's not remove this feature. The <table> has a lot of features, where we try to use most of them here in a meaningful way.

<table class="picospa-chart bar" style="width: 100%;">
    <caption>....</caption>
  
    <tbody style="height: 6em;">
        ...put you data in here, as seen above...
    </tbody>
    <tbody style="--picochart-color: red; height: 8em;">
        ...the bars here will be red...
    </tbody>
    ...put any number of TBODYs after one another
  
    <tfoot>
        ...this will render as grid lines and labels on one axis, 
        for bar chart this is the x-axis, column chart the y-axis...
        The TRs in here will be distributed evenly across the chart's width/height.
        Two row will be the min and max labels+grids, and so on.
    </tfoot>
</table>