A state timeline: one rectangle per datum (spec/07 §11), copied from visualize's
Visualize.Shape.Band.
Each datum spans x0 to x1 at y, height tall, filled per datum. The four
coordinates are pixel accessors: the caller (a layer) applies the x scale. new/0 reads
tuple elements 0 and 1 as the edges, with y = 0 and height = 10:
iex> alias Macaw.Draw.Shape.Band
iex> [rect] = Band.generate(Band.new(), [{50, 10}])
iex> {rect.type, rect.attrs, rect.style}
{:rect, %{x: 10, y: 0, width: 40, height: 10}, %{class: "band"}}generate/2 answers one :rect element per datum in data order, x the lesser edge
and width non-negative, its style %{class: "band"} plus fill: when the fill
accessor answers a value. Coinciding edges give a zero-width rectangle; a datum with an
undefined coordinate is not emitted (§1.1). generate_path/2 folds the rectangles into
one path, the fill playing no part. The fill is a function, an atom field, or a color
value of macaw_layers.
Summary
Functions
Sets the fill: a function, an atom field, or a color value; nil unsets it.
One :rect element per drawn datum, in data order.
One Macaw.Draw.IR.Path of closed rectangles, in data order.
Sets the height accessor, in pixels: a function, a field, or a number.
A band reading tuple elements 0 and 1 as its edges, y = 0 and height = 10.
Sets the start edge accessor, in pixels: a function, a field, or a number.
Sets the end edge accessor, in pixels: a function, a field, or a number.
Sets the top accessor, in pixels: a function, a field, or a number.
Types
Functions
Sets the fill: a function, an atom field, or a color value; nil unsets it.
@spec generate(t(), [term()]) :: [Macaw.Draw.IR.Element.t()] | error()
One :rect element per drawn datum, in data order.
@spec generate_path(t(), [term()]) :: Macaw.Draw.IR.Path.t() | error()
One Macaw.Draw.IR.Path of closed rectangles, in data order.
Sets the height accessor, in pixels: a function, a field, or a number.
@spec new() :: t()
A band reading tuple elements 0 and 1 as its edges, y = 0 and height = 10.
Sets the start edge accessor, in pixels: a function, a field, or a number.
Sets the end edge accessor, in pixels: a function, a field, or a number.
Sets the top accessor, in pixels: a function, a field, or a number.