A discrete scale that divides the range into uniform bands.
Essential for bar charts where each category gets an equal-width band. The band maths
is d3-scale's: a descending range lays the bands out in reverse with positive step
and bandwidth, and round/2 floors the step and rounds the start and bandwidth so
every position is an integer.
Every setter lays the bands out again, as d3-scale's rescale does, and keeps the
layout and each category's slot in the struct, so apply/2, bandwidth/1 and step/1
cost the same over a domain of a thousand categories as over ten (spec/03 §9.3).
Summary
Functions
Sets alignment (0 to 1) for distributing outer space
Returns the start position for a category, or nil when it is not in the domain
Returns the width of each band
Identity: a band scale never extrapolates
Sets the domain (list of categories)
Returns nil: a band scale is not invertible
Creates a new band scale
Identity
Sets both inner and outer padding (0 to 1)
Sets inner padding between bands
Sets outer padding at range edges
Sets the range
Enables rounding: the step is floored, the start and bandwidth rounded
Returns the step (band + padding); floored when round?
Returns the domain as ticks
Types
Functions
Sets alignment (0 to 1) for distributing outer space
Returns the start position for a category, or nil when it is not in the domain
Returns the width of each band
Identity: a band scale never extrapolates
Sets the domain (list of categories)
Returns nil: a band scale is not invertible
@spec new() :: t()
Creates a new band scale
Identity
Sets both inner and outer padding (0 to 1)
Sets inner padding between bands
Sets outer padding at range edges
Sets the range
Enables rounding: the step is floored, the start and bandwidth rounded
Returns the step (band + padding); floored when round?
Returns the domain as ticks