Commit 060b278
feat(traces): add Waterfall trace type
plotly.js has shipped the `waterfall` trace since well before the bundled
3.7.0 build — only the Rust wrapper was missing. It registers with the
same categories as `funnel` (bar-like, cartesian, svg, oriented), so it
composes with subplot grids and static image export. The layout-level
`waterfallmode`/`waterfallgap`/`waterfallgroupgap` attributes and the
`WaterfallMode` enum already existed; this fills in the trace.
Field set is exactly the attributes plotly.js declares in `waterfall`'s
own block, plus the base-trace attributes `Bar` already carries, minus
the date-axis period family — `xperiodalignment` needs a
`PeriodAlignment` enum that does not exist yet, and waterfall's position
axis is categorical in practice. Consequently `base` is scalar
(`arrayOk: false` here, unlike `Bar`), there is no top-level `marker`,
and error bars, calendars and point selection are absent.
`measure` is a typed enum but `textinfo` stays a plain `String`, and the
difference is the schema's: `textinfo` is a `flaglist`, an open-ended
`+`-joined set, so it follows the existing `pie.rs`/`funnel.rs`
precedent. `measure` is a `data_array` whose entries plotly.js validates
against a closed set, silently treating anything it does not recognise
as `relative` — a typo there renders a different chart rather than
raising an error, which is what earns it a type.
Bar colours come from `increasing`/`decreasing`/`totals` rather than a
per-point array, because plotly.js declares every attribute in those
blocks `arrayOk: false`; all three share one `MeasureStyle`/`Marker`
pair since the schema generates them from a single helper. `Connector`
is waterfall's own — it has no `fillcolor` and gains a `ConnectorMode`,
so `funnel::Connector` is not reusable.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com>1 parent 44682fc commit 060b278
9 files changed
Lines changed: 596 additions & 3 deletions
File tree
- docs/book/src
- recipes
- basic_charts
- examples/basic_charts/src
- plotly/src
- common
- traces
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
0 commit comments