Heatmap chart
Rows binned into cells by two keys, aggregated, and coloured by a sequential, diverging or stepped scale: a currency matrix, pair × tenor, hour × weekday, or a calendar of days. Drawn by ECharts, with a colour key that counts, marks and filters.
The figures in these examples are generated for illustration, not real trading or market data.
Import
import '@c2n/components/chart/heatmap-chart'This chart draws with ECharts, a peer dependency it loads on first draw: npm install echarts.
Usage
| Date | Daily P&L (EUR) |
|---|---|
| 2025-10-20 | 35.1k |
| 2025-10-21 | 45.7k |
| 2025-10-22 | 0.6k |
| 2025-10-23 | 16.3k |
| 2025-10-24 | -25.4k |
| 2025-10-27 | 12.9k |
| 2025-10-28 | 15.6k |
| 2025-10-29 | -6.6k |
| 2025-10-30 | 47.7k |
| 2025-10-31 | -5.5k |
| 2025-11-03 | 68.6k |
| 2025-11-04 | 26.3k |
| 2025-11-05 | 28.3k |
| 2025-11-06 | 26.5k |
| 2025-11-07 | -31.8k |
| 2025-11-10 | -14.4k |
| 2025-11-11 | 18.4k |
| 2025-11-12 | 12.3k |
| 2025-11-13 | -17k |
| 2025-11-14 | 20.2k |
| 2025-11-17 | -9.5k |
| 2025-11-18 | 62.2k |
| 2025-11-19 | -26.9k |
| 2025-11-20 | -9.6k |
| 2025-11-21 | -13.2k |
| 2025-11-24 | 95.1k |
| 2025-11-25 | 8.8k |
| 2025-11-26 | -10.4k |
| 2025-11-27 | -72.3k |
| 2025-11-28 | -39.4k |
| 2025-12-01 | -11.2k |
| 2025-12-02 | 53.4k |
| 2025-12-03 | -51k |
| 2025-12-04 | 24.6k |
| 2025-12-05 | 2.2k |
| 2025-12-08 | -1.7k |
| 2025-12-09 | 67.4k |
| 2025-12-10 | 5.4k |
| 2025-12-11 | 4.7k |
| 2025-12-12 | 2k |
| 2025-12-15 | 16.3k |
| 2025-12-16 | 15.5k |
| 2025-12-17 | 8.5k |
| 2025-12-18 | 39.9k |
| 2025-12-19 | -30.4k |
| 2025-12-22 | 20.7k |
| 2025-12-23 | 25k |
| 2025-12-24 | -11.5k |
| 2025-12-29 | 68.1k |
| 2025-12-30 | -45.5k |
| 2025-12-31 | 10.6k |
| 2026-01-02 | 31.2k |
| 2026-01-05 | 7.8k |
| 2026-01-06 | 10.9k |
| 2026-01-07 | -64.4k |
| 2026-01-08 | -24k |
| 2026-01-09 | -27.5k |
| 2026-01-12 | -89.1k |
| 2026-01-13 | 20.2k |
| 2026-01-14 | -56k |
| 2026-01-15 | -4k |
| 2026-01-16 | 16.9k |
| 2026-01-19 | 28k |
| 2026-01-20 | 17k |
| 2026-01-21 | 8.7k |
| 2026-01-22 | 8.2k |
| 2026-01-23 | 3.2k |
| 2026-01-26 | 13.5k |
| 2026-01-27 | 22.5k |
| 2026-01-28 | 27.6k |
| 2026-01-29 | 52.6k |
| 2026-01-30 | 51.4k |
| 2026-02-02 | -5.5k |
| 2026-02-03 | 9.4k |
| 2026-02-04 | 2.4k |
| 2026-02-05 | 67.9k |
| 2026-02-06 | 120.1k |
| 2026-02-09 | -3.9k |
| 2026-02-10 | 46.7k |
| 2026-02-11 | 14.6k |
| 2026-02-12 | -0.3k |
| 2026-02-13 | -15.5k |
| 2026-02-16 | 13.4k |
| 2026-02-17 | -31.1k |
| 2026-02-18 | 17.9k |
| 2026-02-19 | 65.6k |
| 2026-02-20 | 28.4k |
| 2026-02-23 | -47.5k |
| 2026-02-24 | -21.8k |
| 2026-02-25 | -2k |
| 2026-02-26 | -5.7k |
| 2026-02-27 | 32.4k |
| 2026-03-02 | -63.2k |
| 2026-03-03 | 32.5k |
| 2026-03-04 | -6.9k |
| 2026-03-05 | 25k |
| 2026-03-06 | 20.7k |
| 2026-03-09 | 50.9k |
| 2026-03-10 | -38.2k |
| 2026-03-11 | 14k |
| 2026-03-12 | -29.4k |
| 2026-03-13 | -51.4k |
| 2026-03-16 | -11.9k |
| 2026-03-17 | 10.8k |
| 2026-03-18 | 34.8k |
| 2026-03-19 | -73.1k |
| 2026-03-20 | 56.6k |
| 2026-03-23 | -8.9k |
| 2026-03-24 | 48.4k |
| 2026-03-25 | 64.4k |
| 2026-03-26 | 49.5k |
| 2026-03-27 | -71.5k |
| 2026-03-30 | -8.2k |
| 2026-03-31 | -7.3k |
| 2026-04-01 | -15.1k |
| 2026-04-02 | -23.6k |
| 2026-04-07 | 49.5k |
| 2026-04-08 | -35.2k |
| 2026-04-09 | 1.7k |
| 2026-04-10 | 30.9k |
| 2026-04-13 | -6.8k |
| 2026-04-14 | 16.3k |
| 2026-04-15 | -32.9k |
| 2026-04-16 | 19k |
| 2026-04-17 | 40.8k |
| 2026-04-20 | -10.7k |
| 2026-04-21 | 42.2k |
| 2026-04-22 | 12k |
| 2026-04-23 | 26k |
| 2026-04-24 | -10.8k |
| 2026-04-27 | -18.7k |
| 2026-04-28 | -1.9k |
| 2026-04-29 | 11.2k |
| 2026-04-30 | -6.8k |
| 2026-05-04 | -1.3k |
| 2026-05-05 | 62.3k |
| 2026-05-06 | 12.4k |
| 2026-05-07 | -62.5k |
| 2026-05-08 | -30.3k |
| 2026-05-11 | 6.7k |
| 2026-05-12 | -27.7k |
| 2026-05-13 | 0.4k |
| 2026-05-14 | 62.5k |
| 2026-05-15 | -45.5k |
| 2026-05-18 | 65.4k |
| 2026-05-19 | -13.4k |
| 2026-05-20 | -3.6k |
| 2026-05-21 | 12.4k |
| 2026-05-22 | -19.1k |
| 2026-05-25 | -41k |
| 2026-05-26 | -1.9k |
| 2026-05-27 | -38k |
| 2026-05-28 | 30.1k |
| 2026-05-29 | 3.4k |
| 2026-06-01 | -88.7k |
| 2026-06-02 | 15.8k |
| 2026-06-03 | -27k |
| 2026-06-04 | 24.1k |
| 2026-06-05 | -13.4k |
| 2026-06-08 | 147.6k |
| 2026-06-09 | 2.3k |
| 2026-06-10 | 10.2k |
| 2026-06-11 | -3.6k |
| 2026-06-12 | 7.1k |
| 2026-06-15 | 22.8k |
| 2026-06-16 | 5.3k |
| 2026-06-17 | 21.8k |
| 2026-06-18 | -17k |
| 2026-06-19 | 58.2k |
| 2026-06-22 | -23.3k |
| 2026-06-23 | 44.4k |
| 2026-06-24 | -12.2k |
| 2026-06-25 | 53.7k |
| 2026-06-26 | 25.3k |
| 2026-06-29 | 50k |
| 2026-06-30 | -9.1k |
| 2026-07-01 | 15.4k |
| 2026-07-02 | -1.3k |
| 2026-07-03 | -13.6k |
| 2026-07-06 | 42.4k |
| 2026-07-07 | 34.9k |
| 2026-07-08 | 36.4k |
| 2026-07-09 | 13.4k |
| 2026-07-10 | 16.7k |
| 2026-07-13 | -10.3k |
| 2026-07-14 | 58.8k |
| 2026-07-15 | 20.9k |
| 2026-07-16 | 87.7k |
| 2026-07-17 | 59.8k |
| 2026-07-20 | 13k |
| 2026-07-21 | -65.8k |
| 2026-07-22 | 19.8k |
| 2026-07-23 | -26.1k |
| 2026-07-24 | 23.5k |
| 2026-07-27 | -40.8k |
| 2026-07-28 | 5.9k |
| 2026-07-29 | 32.8k |
| 2026-07-30 | -35.6k |
| 2026-07-31 | 1.8k |
| 2026-08-03 | 16.8k |
| 2026-08-04 | 6.6k |
| 2026-08-05 | -16.5k |
| 2026-08-06 | 43.1k |
| 2026-08-07 | -46.4k |
| 2026-08-10 | 9.3k |
| 2026-08-11 | 34.6k |
| 2026-08-12 | -15.6k |
| 2026-08-13 | 16.4k |
| 2026-08-14 | -14.9k |
| 2026-08-17 | 1k |
| 2026-08-18 | 7.1k |
| 2026-08-19 | 9.2k |
| 2026-08-20 | -13.4k |
| 2026-08-21 | 7.6k |
| 2026-08-24 | 4.3k |
| 2026-08-25 | 21.8k |
| 2026-08-26 | 89k |
| 2026-08-27 | 11.8k |
| 2026-08-28 | -44.4k |
| 2026-08-31 | -1.7k |
| 2026-09-01 | 31.1k |
| 2026-09-02 | -13.9k |
| 2026-09-03 | 38.3k |
| 2026-09-04 | 49.4k |
| 2026-09-07 | 111.4k |
| 2026-09-08 | -50k |
| 2026-09-09 | 14.7k |
| 2026-09-10 | -8.2k |
| 2026-09-11 | 37.4k |
| 2026-09-14 | -41.8k |
| 2026-09-15 | 45.9k |
| 2026-09-16 | -22.2k |
| 2026-09-17 | 24.8k |
| 2026-09-18 | 11.3k |
| 2026-09-21 | 29k |
| 2026-09-22 | -27.1k |
| 2026-09-23 | -7.7k |
| 2026-09-24 | -92.9k |
| 2026-09-25 | 7.6k |
| 2026-09-28 | -29.8k |
| 2026-09-29 | 55.8k |
| 2026-09-30 | 29.1k |
| 2026-10-01 | 3k |
| 2026-10-02 | 59.5k |
| 2026-10-05 | 44.9k |
| 2026-10-06 | 2.3k |
| 2026-10-07 | -14.1k |
| 2026-10-08 | -41.9k |
| 2026-10-09 | 24k |
| 2026-10-12 | 16.5k |
| 2026-10-13 | -5.9k |
| 2026-10-14 | 125.1k |
| 2026-10-15 | 2.4k |
| 2026-10-16 | 55.4k |
| Row | Column | 1-day change, base against quote |
|---|---|---|
| USD | EUR | -0.42% |
| USD | JPY | 0.85% |
| USD | GBP | -0.18% |
| USD | CHF | -0.3% |
| USD | AUD | 0.55% |
| USD | CAD | 0.12% |
| USD | NZD | 0.68% |
| EUR | USD | 0.42% |
| EUR | JPY | 1.27% |
| EUR | GBP | 0.24% |
| EUR | CHF | 0.12% |
| EUR | AUD | 0.97% |
| EUR | CAD | 0.54% |
| EUR | NZD | 1.1% |
| JPY | USD | -0.85% |
| JPY | EUR | -1.27% |
| JPY | GBP | -1.03% |
| JPY | CHF | -1.15% |
| JPY | AUD | -0.3% |
| JPY | CAD | -0.73% |
| JPY | NZD | -0.17% |
| GBP | USD | 0.18% |
| GBP | EUR | -0.24% |
| GBP | JPY | 1.03% |
| GBP | CHF | -0.12% |
| GBP | AUD | 0.73% |
| GBP | CAD | 0.3% |
| GBP | NZD | 0.86% |
| CHF | USD | 0.3% |
| CHF | EUR | -0.12% |
| CHF | JPY | 1.15% |
| CHF | GBP | 0.12% |
| CHF | AUD | 0.85% |
| CHF | CAD | 0.42% |
| CHF | NZD | 0.98% |
| AUD | USD | -0.55% |
| AUD | EUR | -0.97% |
| AUD | JPY | 0.3% |
| AUD | GBP | -0.73% |
| AUD | CHF | -0.85% |
| AUD | CAD | -0.43% |
| AUD | NZD | 0.13% |
| CAD | USD | -0.12% |
| CAD | EUR | -0.54% |
| CAD | JPY | 0.73% |
| CAD | GBP | -0.3% |
| CAD | CHF | -0.42% |
| CAD | AUD | 0.43% |
| CAD | NZD | 0.56% |
| NZD | USD | -0.68% |
| NZD | EUR | -1.1% |
| NZD | JPY | 0.17% |
| NZD | GBP | -0.86% |
| NZD | CHF | -0.98% |
| NZD | AUD | -0.13% |
| NZD | CAD | -0.56% |
| Row | Column | ATM implied vol |
|---|---|---|
| EURUSD | ON | 8% |
| EURUSD | 1W | 7.2% |
| EURUSD | 1M | 6.9% |
| EURUSD | 3M | 6.9% |
| EURUSD | 6M | 7.3% |
| EURUSD | 1Y | 7.6% |
| USDJPY | ON | 11.1% |
| USDJPY | 1W | 9.9% |
| USDJPY | 1M | 9.5% |
| USDJPY | 3M | 10.3% |
| USDJPY | 6M | 10.4% |
| USDJPY | 1Y | 10.7% |
| GBPUSD | ON | 8.6% |
| GBPUSD | 1W | 8.1% |
| GBPUSD | 1M | 8% |
| GBPUSD | 3M | 7.8% |
| GBPUSD | 6M | 8.3% |
| GBPUSD | 1Y | 8.7% |
| AUDUSD | ON | 11% |
| AUDUSD | 1W | 9.8% |
| AUDUSD | 1M | 9.1% |
| AUDUSD | 3M | 9.5% |
| AUDUSD | 6M | 9.9% |
| AUDUSD | 1Y | 10.2% |
| USDCHF | ON | 8.5% |
| USDCHF | 1W | 7.6% |
| USDCHF | 1M | 7.7% |
| USDCHF | 3M | 7.8% |
| USDCHF | 6M | 7.9% |
| USDCHF | 1Y | 8.3% |
| USDBRL | ON | 16.2% |
| USDBRL | 1W | 14.5% |
| USDBRL | 1M | 13.8% |
| USDBRL | 3M | 14.5% |
| USDBRL | 6M | 14.5% |
| USDBRL | 1Y | 15.3% |
| USDMXN | ON | 14.6% |
| USDMXN | 1W | 13.3% |
| USDMXN | 1M | 12.2% |
| USDMXN | 3M | 12.4% |
| USDMXN | 6M | 13.5% |
| USDMXN | 1Y | 13.8% |
| USDZAR | ON | 17.1% |
| USDZAR | 1W | 15.2% |
| USDZAR | 1M | 14.5% |
| USDZAR | 3M | 15.5% |
| USDZAR | 6M | 15.9% |
| USDZAR | 1Y | 16.4% |
| USDINR | ON | 5.7% |
| USDINR | 1W | 5% |
| USDINR | 1M | 4.8% |
| USDINR | 3M | 5% |
| USDINR | 6M | 5% |
| USDINR | 1Y | 5.2% |
| Row | Column | Fills per hour (UTC) |
|---|---|---|
| Mon | 00 | 56 |
| Mon | 01 | 77 |
| Mon | 02 | 84 |
| Mon | 03 | 62 |
| Mon | 04 | 36 |
| Mon | 05 | 46 |
| Mon | 06 | 74 |
| Mon | 07 | 143 |
| Mon | 08 | 159 |
| Mon | 09 | 135 |
| Mon | 10 | 66 |
| Mon | 11 | 59 |
| Mon | 12 | 90 |
| Mon | 13 | 137 |
| Mon | 14 | 192 |
| Mon | 15 | 190 |
| Mon | 16 | 166 |
| Mon | 17 | 75 |
| Mon | 18 | 36 |
| Mon | 19 | 21 |
| Mon | 20 | 18 |
| Mon | 21 | 16 |
| Mon | 22 | 18 |
| Mon | 23 | 16 |
| Tue | 00 | 56 |
| Tue | 01 | 77 |
| Tue | 02 | 78 |
| Tue | 03 | 55 |
| Tue | 04 | 35 |
| Tue | 05 | 39 |
| Tue | 06 | 71 |
| Tue | 07 | 152 |
| Tue | 08 | 178 |
| Tue | 09 | 134 |
| Tue | 10 | 74 |
| Tue | 11 | 49 |
| Tue | 12 | 75 |
| Tue | 13 | 148 |
| Tue | 14 | 223 |
| Tue | 15 | 227 |
| Tue | 16 | 159 |
| Tue | 17 | 91 |
| Tue | 18 | 34 |
| Tue | 19 | 22 |
| Tue | 20 | 23 |
| Tue | 21 | 15 |
| Tue | 22 | 17 |
| Tue | 23 | 18 |
| Wed | 00 | 57 |
| Wed | 01 | 78 |
| Wed | 02 | 74 |
| Wed | 03 | 58 |
| Wed | 04 | 38 |
| Wed | 05 | 41 |
| Wed | 06 | 63 |
| Wed | 07 | 125 |
| Wed | 08 | 168 |
| Wed | 09 | 124 |
| Wed | 10 | 70 |
| Wed | 11 | 55 |
| Wed | 12 | 77 |
| Wed | 13 | 160 |
| Wed | 14 | 231 |
| Wed | 15 | 223 |
| Wed | 16 | 158 |
| Wed | 17 | 78 |
| Wed | 18 | 32 |
| Wed | 19 | 22 |
| Wed | 20 | 19 |
| Wed | 21 | 17 |
| Wed | 22 | 18 |
| Wed | 23 | 19 |
| Thu | 00 | 52 |
| Thu | 01 | 79 |
| Thu | 02 | 86 |
| Thu | 03 | 54 |
| Thu | 04 | 38 |
| Thu | 05 | 39 |
| Thu | 06 | 83 |
| Thu | 07 | 138 |
| Thu | 08 | 180 |
| Thu | 09 | 128 |
| Thu | 10 | 77 |
| Thu | 11 | 52 |
| Thu | 12 | 69 |
| Thu | 13 | 170 |
| Thu | 14 | 233 |
| Thu | 15 | 187 |
| Thu | 16 | 161 |
| Thu | 17 | 77 |
| Thu | 18 | 37 |
| Thu | 19 | 22 |
| Thu | 20 | 16 |
| Thu | 21 | 18 |
| Thu | 22 | 20 |
| Thu | 23 | 17 |
| Fri | 00 | 52 |
| Fri | 01 | 67 |
| Fri | 02 | 68 |
| Fri | 03 | 58 |
| Fri | 04 | 43 |
| Fri | 05 | 40 |
| Fri | 06 | 76 |
| Fri | 07 | 159 |
| Fri | 08 | 161 |
| Fri | 09 | 128 |
| Fri | 10 | 80 |
| Fri | 11 | 54 |
| Fri | 12 | 74 |
| Fri | 13 | 138 |
| Fri | 14 | 223 |
| Fri | 15 | 222 |
| Fri | 16 | 136 |
| Fri | 17 | 42 |
| Fri | 18 | 19 |
| Fri | 19 | 12 |
| Fri | 20 | 10 |
| Fri | 21 | 10 |
| Fri | 22 | 10 |
| Fri | 23 | 11 |
| Sat | 00 | 7 |
| Sat | 01 | 5 |
| Sat | 02 | 5 |
| Sat | 03 | 8 |
| Sat | 04 | 6 |
| Sat | 05 | 7 |
| Sat | 06 | 6 |
| Sat | 07 | 9 |
| Sat | 08 | 5 |
| Sat | 09 | 6 |
| Sat | 10 | 7 |
| Sat | 11 | 8 |
| Sat | 12 | 6 |
| Sat | 13 | 6 |
| Sat | 14 | 7 |
| Sat | 15 | 7 |
| Sat | 16 | 6 |
| Sat | 17 | 5 |
| Sat | 18 | 4 |
| Sat | 19 | 8 |
| Sat | 20 | 4 |
| Sat | 21 | 8 |
| Sat | 22 | 5 |
| Sat | 23 | 6 |
| Sun | 00 | 6 |
| Sun | 01 | 5 |
| Sun | 02 | 6 |
| Sun | 03 | 6 |
| Sun | 04 | 6 |
| Sun | 05 | 4 |
| Sun | 06 | 4 |
| Sun | 07 | 3 |
| Sun | 08 | 3 |
| Sun | 09 | 4 |
| Sun | 10 | 6 |
| Sun | 11 | 6 |
| Sun | 12 | 5 |
| Sun | 13 | 4 |
| Sun | 14 | 4 |
| Sun | 15 | 4 |
| Sun | 16 | 6 |
| Sun | 17 | 6 |
| Sun | 18 | 5 |
| Sun | 19 | 3 |
| Sun | 20 | 6 |
| Sun | 21 | 66 |
| Sun | 22 | 45 |
| Sun | 23 | 63 |
A heatmap is one idea in three layouts. Rows are put into cells by two keys, the rows that share a cell are combined by aggregate, and each cell is coloured by its value. A calendar is one way to get the two keys, from a date; any two fields are others: a currency against a currency, a pair against a tenor, an hour against a weekday.
layout | Keys | Typical use |
|---|---|---|
grid (the default) | x-field columns × y-field rows | Cross-currency moves, implied vol by tenor, cohort retention, a correlation matrix |
calendar | date-field: a column per week, a row per weekday, labelled by month | Daily P&L, contributions, incidents per day |
calendar-month | date-field: one month grid per month, with day numbers when there is room | Daily figures read by date: realized vol, bookings |
Keys and order
x-bin and y-bin derive a key from a date field instead of reading it as it is: hour, weekday, day, week, month, quarter or year. One timestamp binned twice, x-bin="hour" and y-bin="weekday", is the general form of the calendar. A timestamp’s day and hour are read in the local time zone, or in UTC with time-zone="utc"; a plain YYYY-MM-DD date is that day in either.
x-order and y-order order the axes:
data: the order keys first appear in the rows (the default for a plain key);naturalornatural-desc: numeric-aware text order, or time order for a binned key (the default for one);tenor: by maturity, soON,TN,1W,1M,3M,1Y,1Y6M,10Ysort the way a curve reads, whatever order the quotes arrive in;value-ascorvalue-desc: by each column’s or row’s total;x(rows only): the rows mirror the columns, for a matrix;- a JSON list of keys,
x-order='["USD", "EUR", "JPY"]', which also adds listed columns that have no rows.
group-field bands the rows into labelled groups, G10 and EM pairs or one desk per band, in group-order. diagonal="hide" blanks the cells whose two keys are equal, as a cross-currency matrix needs. marginals adds bars with each column’s total along the top (top), each row’s along the end (end), or both.
Aggregation
aggregate combines the rows that share a cell: sum (the default), mean, count, min, max, first or last. count needs no value-field. The marginal totals aggregate the rows of the whole column or row the same way, so a mean stays a mean of rows. The tooltip says how many rows a cell holds, and cell-click hands them over in detail.rows.
On the calendar layouts, range sets the span, a year (2026), months (2026-08/2026-10) or days, and every day in it without rows is drawn empty, in --c2-chart__cell__empty--background-color. Without range the span runs from the first day with rows to the last. weekdays="mon-fri" drops weekends, as trading days do; week-start="sunday" starts the weeks on Sunday.
Scales
The colour scale is the one c2-map-chart uses. scale="sequential" (the default) shades from --c2-chart__scale-start--color to --c2-chart__scale-end--color across the data’s extent. scale="diverging" runs from --c2-chart__scale-negative--color through --c2-chart__scale-mid--color to the end colour around 0, with a range symmetric around it, so a loss and a gain of the same size are equally strong. domain pins the ends, [min, max] or [min, mid, max], so two heatmaps can be compared; thresholds turns either scale into stepped classes, and scale-colors gives one colour per class.
The default diverging pair is orange and blue, which stay apart for readers with red-green colour blindness. A desk that expects green and red can set them with scale-colors, as the gallery’s gain and loss card does; keep the stepped key or the cell labels as a second cue.
Each cell’s value is written in it when it fits (cell-labels="auto"), on every cell (always), or never (none), in --c2-chart__cell-label--color on a light cell and --c2-chart__cell-label__inverse--color on a dark one. unit is appended to every value; format is the property for anything else.
The colour key
The built-in legend is the colour key, and by default (legend-detail="histogram") it does more than list colours:
- bars above the scale count the cells in each band, so the reader sees how the values are spread before reading a single cell;
- a stepped scale is labelled at the breaks between its classes, a continuous one at round values;
scale-polesnames what each end means (["loss", "gain"]), and an arrow at an end shows that some values lie past the scale’s domain;- hovering a cell marks its value on the scale and counts the cells in its band;
- hovering a band previews it, dimming the other cells; clicking keeps it, and on a continuous scale a drag keeps a range. The readout gives the count and, for a sum or a count, the total.
legend places the key: below the plot (bottom, the default), above it (top), or beside it (start or end, left and right in a left-to-right page), where the key stands upright with its low end at the bottom, as on a value axis, and its ends named above and below it. A square matrix leaves room at the side, as in the currency matrix above; --c2-chart__scale-key--height sets the upright key’s length.
legend-detail="simple" keeps the bar, its ticks and its ends. Each line of text can also be hidden on its own, through a CSS variable set to none:
| Variable | Hides |
|---|---|
--c2-chart__scale-key-title--display | The key’s title |
--c2-chart__scale-key-readout--display | The line under the title: count, range, total, and the hovered cell’s value |
--c2-chart__scale-key-total--display | Only the total, for values that do not add up to anything (a mean, a rate, a % change) |
--c2-chart__scale-key-hint--display | The “hover a band…” line (always hidden beside the plot) |
--c2-chart__scale-key-poles--display | The names of the two ends |
To show the heatmap alone, legend="none" removes the key and --c2-chart__axis-label--display: none removes the row, column, group and month labels, giving the cells the room they took: a compact calendar in a table row or a card, with the tooltip still naming each cell. cell-labels="none" clears the values from the cells too. A calendar keeps square cells, at most --c2-chart__cell--max-size on a side.
legend-interaction="preview" only previews, and none makes the key a plain picture. The kept range is scale-filter, [from, to) with null for an open end; the application can set it, to share one filter between two heatmaps, and scale-filter-change reports the reader’s changes. legend="none" hides the key.
Keyboard and events
The plot is one tab stop: the arrow keys move from cell to cell, a calendar’s left and right moving a week, Home and End go to the ends of the row, Enter fires cell-click and Escape leaves. The focused cell is announced, and a hidden table lists every cell with a value for screen readers. On the colour key, Tab reaches the bands, or the scale of a continuous key, where the arrow keys pick a band, Shift extends it, Enter keeps it and Escape clears it.
cell-hover and cell-click carry the cell’s keys, labels, value, row count and rows; the cells property lists every cell with rows, for a table or an export.