Skip to content
bahtuiv0.18.8

<baht-heatmap>

Calendar heat for one month or N weeks: one cell per day on the sequential ramp, a weekday header, a per-cell tooltip and a “less / more” scale legend.

Spending days, September

<baht-heatmap from="2026-09-01" to="2026-09-30" format="currency"></baht-heatmap>

<script>
  const el = document.querySelector('baht-heatmap');
  el.values = [
    {
      "date": "2026-09-01",
      "value": 420
    },
    {
      "date": "2026-09-02",
      "value": 0
    },
    {
      "date": "2026-09-03",
      "value": 180
    },
    {
      "date": "2026-09-04",
      "value": 960
    },
    {
      "date": "2026-09-05",
      "value": 240
    },
    {
      "date": "2026-09-06",
      "value": 0
    },
    {
      "date": "2026-09-07",
      "value": 1200
    },
    {
      "date": "2026-09-08",
      "value": 340
    },
    {
      "date": "2026-09-09",
      "value": 0
    },
    {
      "date": "2026-09-10",
      "value": 0
    },
    {
      "date": "2026-09-11",
      "value": 760
    },
    {
      "date": "2026-09-12",
      "value": 410
    },
    {
      "date": "2026-09-13",
      "value": 180
    },
    {
      "date": "2026-09-14",
      "value": 2100
    },
    {
      "date": "2026-09-15",
      "value": 150
    },
    {
      "date": "2026-09-16",
      "value": 0
    },
    {
      "date": "2026-09-17",
      "value": 320
    },
    {
      "date": "2026-09-18",
      "value": 480
    },
    {
      "date": "2026-09-19",
      "value": 90
    },
    {
      "date": "2026-09-20",
      "value": 0
    },
    {
      "date": "2026-09-21",
      "value": 640
    },
    {
      "date": "2026-09-22",
      "value": 1180
    },
    {
      "date": "2026-09-23",
      "value": 220
    },
    {
      "date": "2026-09-24",
      "value": 0
    },
    {
      "date": "2026-09-25",
      "value": 380
    },
    {
      "date": "2026-09-26",
      "value": 0
    },
    {
      "date": "2026-09-27",
      "value": 510
    },
    {
      "date": "2026-09-28",
      "value": 740
    },
    {
      "date": "2026-09-29",
      "value": 160
    },
    {
      "date": "2026-09-30",
      "value": 0
    }
  ];
</script>

show-values swaps the compact SVG for an HTML month grid: the day number and the formatted value sit in every cell, empty days print zero-label. The two darkest steps flip to light text. Cell height is --baht-heatmap-cell-min (56px, 44px under 480px).

Spending calendar

<baht-heatmap from="2026-09-01" to="2026-09-30" format="compact" show-values="true" zero-label="—" label="Spending per day, September 2026"></baht-heatmap>

<script>
  const el = document.querySelector('baht-heatmap');
  el.values = [
    {
      "date": "2026-09-01",
      "value": 420
    },
    {
      "date": "2026-09-02",
      "value": 0
    },
    {
      "date": "2026-09-03",
      "value": 180
    },
    {
      "date": "2026-09-04",
      "value": 960
    },
    {
      "date": "2026-09-05",
      "value": 240
    },
    {
      "date": "2026-09-06",
      "value": 0
    },
    {
      "date": "2026-09-07",
      "value": 1200
    },
    {
      "date": "2026-09-08",
      "value": 340
    },
    {
      "date": "2026-09-09",
      "value": 0
    },
    {
      "date": "2026-09-10",
      "value": 0
    },
    {
      "date": "2026-09-11",
      "value": 760
    },
    {
      "date": "2026-09-12",
      "value": 410
    },
    {
      "date": "2026-09-13",
      "value": 180
    },
    {
      "date": "2026-09-14",
      "value": 2100
    },
    {
      "date": "2026-09-15",
      "value": 150
    },
    {
      "date": "2026-09-16",
      "value": 0
    },
    {
      "date": "2026-09-17",
      "value": 320
    },
    {
      "date": "2026-09-18",
      "value": 480
    },
    {
      "date": "2026-09-19",
      "value": 90
    },
    {
      "date": "2026-09-20",
      "value": 0
    },
    {
      "date": "2026-09-21",
      "value": 640
    },
    {
      "date": "2026-09-22",
      "value": 1180
    },
    {
      "date": "2026-09-23",
      "value": 220
    },
    {
      "date": "2026-09-24",
      "value": 0
    },
    {
      "date": "2026-09-25",
      "value": 380
    },
    {
      "date": "2026-09-26",
      "value": 0
    },
    {
      "date": "2026-09-27",
      "value": 510
    },
    {
      "date": "2026-09-28",
      "value": 740
    },
    {
      "date": "2026-09-29",
      "value": 160
    },
    {
      "date": "2026-09-30",
      "value": 0
    }
  ];
</script>
NameTypeDefaultDescription
valuesJSChartDatePoint[][]{ date: 'YYYY-MM-DD', value }[]; missing days render empty
fromstring''First day (inclusive); defaults to the earliest value
tostring''Last day (inclusive); defaults to the latest value
less-labelstring'Less'Low end of the scale legend
more-labelstring'More'High end of the scale legend
zero-labelstring'—'Text printed in an empty cell in show-values mode
show-valuesbooleanfalseHTML month grid with the day number and value in each cell
labelstring''Accessible summary; falls back to a generated sentence
empty-messagestring'No data to chart'Shown when there are no values
loadingbooleanfalseHold the previous render at 0.5 opacity
show-tablebooleantrueRender the "View as table" twin
formatChartFormat'number'number | currency | percent | compact
currencystring'THB'ISO currency code for `format="currency"` (THB renders `฿`).