shadcn.io is not affiliated with official shadcn/ui
Horizon Chart Grid Stats Block for React
Six regions of CDN throughput as 48 px horizon strips with three folded bands, a baseline, the current value and the change on an hour ago, and a key that explains how to read the bands.
Installation
Overview
A horizon chart grid for React with Base UI. A start-aligned header names the region carrying the most traffic, "North America West is carrying 98.8 Gbps", with the total across regions beside it. Under it, one framed grid of six regions in rows that share hairlines. Each row folds 24 hours of throughput, a reading every half hour, into one thin strip: three bands of 40 Gbps each, drawn as areas on one baseline in three solid weights of the text colour, so a darker strip is a higher reading and a 120 Gbps range fits in 48 px. The region's name and peak, its current throughput and its change on an hour ago sit round it, and a key explains how to read the bands (1×, 2×, 3×). The 48 readings per region are generated at module scope from a seeded day curve and every band path, current value, change and peak is computed from them. On a phone each row keeps its strip, under the name and the value. For traffic, load and any set of time series that must be compared in little space.
FAQ
How do I use my own readings?
Replace REGIONS and readingsOf at the top of the file: readingsOf must return one array of numbers per region, oldest first, and SAMPLES is how many it holds. STEP is each band's height in the unit of the data, and three bands fold 3 × STEP; a reading above that is capped, so raise STEP if your peaks are higher. The band paths, the current value, the change, the peak and the headline are computed from the arrays.
How do I read a horizon strip?
A strip is a line chart folded twice. The lightest band covers 0 to 40 Gbps, the middle 40 to 80 and the darkest 80 to 120, and each band is drawn full height on the same baseline, so where the strip is dark the reading is high and where it is light the reading is low. All strips share one step, so a pale strip really is quieter than a dark one. The key says it in words.
Why three grey weights and no colours?
The weights (20%, 45% and 80% of the text colour, each mixed solid with the page colour) keep the bands opaque, so a darker band always covers the lighter one beneath it, and they follow any theme, light or dark. A hue would add a meaning (good or bad) the data doesn't have.
Is it accessible?
The strips are hidden from assistive technology. Each row says its region, its peak, its current value and its change in text, an unseen table adds the low, and the figure's caption names the chart. The change has an arrow and a true minus sign, the arrows are trend arrows so they don't mirror, and the strip is forced left to right so the oldest reading is at the start in every language.
What happens on a phone?
Each row becomes two lines: the region with its current value and change, then the strip at full width, so the shape stays readable at 320 pixels. The "vs 1 h ago" text is dropped from the change (the table keeps it) and the key moves under the rows. The strips draw in from the start once on load; with reduced motion they are simply there.
Related
- Pro
Sortable Sparkline Tile Grid Stats
KPI bands and tilesSix web-vitals tiles in one hairline frame, each with a fourteen-day line, its low and high marked by ticks, and a Sort by switch that re-orders them by change, budget used or volatility.
- Pro
Dual Series Area Chart Stats
Area and lineHome-solar generation against use over one day: two overlapping areas in two weights, the surplus hours hatched, a legend and a band of three totals under the chart.
- Pro
Hourly Matrix Heatmap Stats
HeatmapsA seven-day by 24-hour matrix of tiny squares in five foreground steps, with 00, 06, 12 and 18 hour markers, an outlined busiest hour and a readout in the frame's foot.
- Pro
A table of services in a tinted frame with sortable column heads, 30-day uptime strips, response times and error rates, and a mark and a word on any service that is down.
- Pro
Stacked Metrics Sparkline Stats
SparklinesThree app cards for a studio, each with a hero audience figure that rolls up, a twelve-week line and two supporting measures with tiny bar series, in cells set apart with overshoot lines.
- Pro
Stacked Area Chart Breakdown Stats
Area and lineA stacked area chart of weekly signups by channel in three foreground weights, with a legend of each channel's share beside it; pointing at a row or a layer keeps that layer and fades the others.