spark
GraphSpark
A sparkline made of block characters, scaled to the highest value. Write `2 3 5 8 — caption` inside the tag.
- use it
- Good for a handful of numbers when you don't need an axis.
- instead
- If you need a y-scale, use Plot.
written
Numbers as children. `0*3` repeats a value. The caption follows an em dash.
three quiet days, then a busy week
Sparkline with 9 points. three quiet days, then a busy week<GraphSpark title="DEPLOYS">
2 3 0*3 5 8 6 9 — three quiet days, then a busy week
</GraphSpark>install
command
latency
data can be a string of numbers. The last point is the accent.
last point is the accent
Sparkline with 12 points. last point is the accentimport { GraphSpark } from "@/registry/default/graph-spark/graph-spark"
<GraphSpark title="LATENCY" data="2 3 4 3 6 5 8 7 9 6 10 8" caption="last point is the accent" />requests
A quieter series.
last twelve deploys
Sparkline with 12 points. last twelve deploysimport { GraphSpark } from "@/registry/default/graph-spark/graph-spark"
<GraphSpark
title="REQUESTS"
data={[4, 4, 5, 3, 6, 8, 7, 9, 8, 6, 5, 7]}
caption="last twelve deploys"
/>| Prop | Type | Default | Description |
|---|---|---|---|
| title | string | — | Caption drawn on the top edge of the frame. |
| data | number[] | "2 3 4" | — | Relative values. Scaled to the max. Optional when children are Markdown. |
| children | Markdown | — | 2 3 5 8 13 — last point is the accent |
| caption | string | — | Muted line under the sparkline. |
| glyphs | "shade" | "ascii" | "hash" | "bar" | string[] | ▁▂▃▄▅▆▇█ | Defaults to spark bars. Pass shade, ascii, hash, bar, or your own characters. |
| palette | "mono" | "duo" | "multi" | "mono" | mono is one accent plus muted. duo paints the second series with --graph-accent-2. multi cycles three accents. |
| corner | string | "+" | Character at each corner of the frame. |
| frame | "box" | "corners" | "rule" | "none" | "box" | box draws the dashed border. corners keeps only the corner marks. rule draws dashed lines above and below. none drops the border and padding, and puts the title above the content. |
| className | string | — | Passed to the outer frame. |