Chart
A chart drawn as inline SVG, no script: columns over a set of labels, stacked where there is more than one series, or a line over time. Every column answers to hover, and the same numbers sit under it as a table for anybody who can't or won't.
Stacked columns over days
One { label:, values: } per series, values keyed by the label. format: says how every number reads; a total: shows in the legend.
- Suno · $152
- ElevenLabs · $156
- Meshy · $140
As a table
| Label | Suno | ElevenLabs | Meshy |
|---|---|---|---|
| 1 Sep | $8.90 | $1.90 | $0.30 |
| 2 Sep | $8.10 | $3.80 | $0.60 |
| 3 Sep | $7.30 | $5.70 | $0.90 |
| 4 Sep | $6.50 | $7.60 | $1.20 |
| 5 Sep | $5.70 | $9.50 | $1.50 |
| 6 Sep | $4.90 | $1.70 | $1.80 |
| 7 Sep | $4.10 | $3.60 | $2.10 |
| 8 Sep | $3.30 | $5.50 | $2.40 |
| 9 Sep | $2.50 | $7.40 | $2.70 |
| 10 Sep | $1.70 | $9.30 | $3.00 |
| 11 Sep | $0.90 | $1.50 | $3.30 |
| 12 Sep | $0.10 | $3.40 | $3.60 |
| 13 Sep | $9.00 | $5.30 | $3.90 |
| 14 Sep | $8.20 | $7.20 | $4.20 |
| 15 Sep | $7.40 | $9.10 | $4.50 |
| 16 Sep | $6.60 | $1.30 | $4.80 |
| 17 Sep | $5.80 | $3.20 | $5.10 |
| 18 Sep | $5.00 | $5.10 | $5.40 |
| 19 Sep | $4.20 | $7.00 | $5.70 |
| 20 Sep | $3.40 | $8.90 | $6.00 |
| 21 Sep | $2.60 | $1.10 | $6.30 |
| 22 Sep | $1.80 | $3.00 | $6.60 |
| 23 Sep | $1.00 | $4.90 | $6.90 |
| 24 Sep | $0.20 | $6.80 | $7.20 |
| 25 Sep | $9.10 | $8.70 | $7.50 |
| 26 Sep | $8.30 | $0.90 | $7.80 |
| 27 Sep | $7.50 | $2.80 | $8.10 |
| 28 Sep | $6.70 | $4.70 | $8.40 |
| 29 Sep | $5.90 | $6.60 | $8.70 |
| 30 Sep | $5.10 | $8.50 | $9.00 |
<% days = (Date.new(2026, 9, 1)..Date.new(2026, 9, 30)).to_a %>
<% seed = ->(d, k) { ((d.day * k * 7919) % 97) / 10.0 } %>
<%= chart [
{ label: "Suno", values: days.to_h { |d| [ d, seed.(d, 3) ] }, total: days.sum { |d| seed.(d, 3) } },
{ label: "ElevenLabs", values: days.to_h { |d| [ d, seed.(d, 5) ] }, total: days.sum { |d| seed.(d, 5) } },
{ label: "Meshy", values: days.to_h { |d| [ d, seed.(d, 11) ] }, total: days.sum { |d| seed.(d, 11) } }
], labels: days, title: "Spend by provider", format: :money %>A line over time
type: :line for a reading that's always there. A nil value is a gap the line doesn't bridge, and the newest reading gets a dot. max: pins the top of the axis.
As a table
| Label | CPU |
|---|---|
| 07:25 | 35% |
| 07:26 | 40% |
| 07:27 | 45% |
| 07:28 | 49% |
| 07:29 | 52% |
| 07:30 | 54% |
| 07:31 | 55% |
| 07:32 | 55% |
| 07:33 | 53% |
| 07:34 | 51% |
| 07:35 | 47% |
| 07:36 | 43% |
| 07:37 | 38% |
| 07:38 | 33% |
| 07:39 | 28% |
| 07:40 | 24% |
| 07:41 | 20% |
| 07:42 | 17% |
| 07:43 | 15% |
| 07:44 | 15% |
| 07:50 | 34% |
| 07:51 | 39% |
| 07:52 | 44% |
| 07:53 | 48% |
| 07:54 | 51% |
| 07:55 | 54% |
| 07:56 | 55% |
| 07:57 | 55% |
| 07:58 | 53% |
| 07:59 | 51% |
| 08:00 | 47% |
| 08:01 | 43% |
| 08:02 | 38% |
| 08:03 | 33% |
| 08:04 | 29% |
| 08:05 | 24% |
| 08:06 | 20% |
| 08:07 | 17% |
| 08:08 | 16% |
| 08:09 | 15% |
| 08:10 | 16% |
| 08:11 | 17% |
| 08:12 | 20% |
| 08:13 | 24% |
| 08:14 | 29% |
| 08:15 | 34% |
| 08:16 | 39% |
| 08:17 | 43% |
| 08:18 | 48% |
| 08:19 | 51% |
| 08:20 | 54% |
| 08:21 | 55% |
| 08:22 | 55% |
| 08:23 | 54% |
| 08:24 | 51% |
<% times = (0..59).map { |i| @now - (59 - i).minutes } %>
<% values = times.each_with_index.map { |_, i| i.between?(20, 24) ? nil : 35 + (Math.sin(i / 4.0) * 20).round } %>
<%= chart [ { label: "CPU", values: values } ], labels: times, type: :line, format: :percent, max: 100,
title: "CPU, last hour", label_format: ->(t) { t.strftime("%H:%M") } %>Three abreast
width: is the drawing's own width; it scales to its box, so a narrow one keeps a readable axis.
<% days = (Date.new(2026, 9, 24)..Date.new(2026, 9, 30)).to_a %>
<div class="grid gap-4 sm:grid-cols-3">
<% [ [ "Renders", 3 ], [ "Imports", 5 ], [ "Chats", 7 ] ].each do |name, k| %>
<%= card do %>
<%= chart [ { label: name, values: days.map { |d| (d.day * k) % 40 + 5 } } ], labels: days, title: name, width: 300, table: false %>
<% end %>
<% end %>
</div>