Stream Graph
Source: Data Visualisation Catalogue - Stream Graph
Why This Belongs In The Compiler Gallery
Stream graphs are the natural next test after stacked area graphs. They use the same stacked area bands, but the stack baseline is centered around a moving middle instead of starting at zero. That makes the chart a focused compiler test for non-zero stack baselines plus smooth area path interpolation.
Data Contract
Each raw row represents one series value at one ordered period.
| Field | Type | Purpose |
|---|---|---|
period | ordinal | Ordered position on the x-axis. |
periodIndex | quantitative | Stable sort key for path construction. |
series | categorical | Stream member and color key. |
value | quantitative | Raw magnitude. |
start | quantitative, derived | Lower boundary emitted by the stream stack mode. |
end | quantitative, derived | Upper boundary emitted by the stream stack mode. |
Expected Visual
The faithful catalogue version should show smooth colored bands flowing across periods, with the total stack centered around a changing baseline. The chart emphasizes relative flow shape more than exact point reading.
| Element | Expected treatment |
|---|---|
| Bands | Filled area bands between start and end. |
| Baseline | Centered per period by the stack transform's stream mode. |
| Curve | Smooth interpolation through ordered period centers. |
| Color | Ordinal palette keyed by series. |
| Legend | Generated color legend. |
Compiler Mapping
| Compiler part | Mapping |
|---|---|
| Data source | raw-stream-series and derived segments. |
| Transform | stack with mode: "stream" computes centered start and end boundaries. |
| Scales | x: band, y: linear(start/end), color: ordinal. |
| Layers | Smooth path area bands using y0 and y1. |
| Guides | Generated x/y axes, gridlines, and color legend. |
Faithfulness Notes
The first gallery version covers the catalogue's core streamgraph anatomy: centered stack boundaries and smooth filled bands are compiler-owned. Remaining polish is stream-specific ordering/wiggle baselines and richer hover/label policies for dense streams.