Binds a D3.js waterfall chart to MAIDR, generating the accessible data
representation.
Point selector at one element per step — the floating <rect> the bar is
drawn as, or a <g> wrapping it and its label. The step's two running
totals are read from the datum: start is where the bar's base sits and
end where its top does, which is what a waterfall's y scale is already
called with.
Mark the totals. An opening, closing or subtotal bar is drawn exactly
like a step but contributes nothing, and no amount of looking at the numbers
reveals which bars those are — so pass a kind accessor for them. Without
one they are announced as ordinary increases, and the chart's count of
increases and decreases includes bars that changed nothing.
Parameters
svg: Element
The SVG element containing the D3 waterfall chart.
A D3BinderResult with the MAIDR data and generated layer.
Remarks
Timing — call after D3 has rendered. Like every D3 binder, this reads
each matched element's D3-bound __data__; calling it before
.data().join() has run (or before the SVG is mounted) throws "No elements
found for selector …" or "Property '…' not found on datum".
Binds a D3.js waterfall chart to MAIDR, generating the accessible data representation.
Point
selectorat one element per step — the floating<rect>the bar is drawn as, or a<g>wrapping it and its label. The step's two running totals are read from the datum:startis where the bar's base sits andendwhere its top does, which is what a waterfall'syscale is already called with.Mark the totals. An opening, closing or subtotal bar is drawn exactly like a step but contributes nothing, and no amount of looking at the numbers reveals which bars those are — so pass a
kindaccessor for them. Without one they are announced as ordinary increases, and the chart's count of increases and decreases includes bars that changed nothing.