A shaded interval between two domain values, with an optional label (spec/07 §13),
copied from visualize's Visualize.Shape.XBand: an incident, a maintenance window,
under the rule's model.
x0/x1 are domain accessors mapped by scale/2 (no scale: pixels), y0/y1 the
pixel extent. new/0 reads tuple elements 0 and 1 as the edges and fills the region as
a brush selection is filled, Macaw.Layers.Color.rgb(119, 119, 119, 0.2):
iex> alias Macaw.Draw.Shape.XBand
iex> [group] = XBand.generate(XBand.new(), [{30, 10}])
iex> [rect] = group.children
iex> rect.attrs
%{x: 10, y: 0, width: 20, height: 100}generate/2 answers one :group per datum, style: %{class: "x-band"}: a :rect
between the mapped edges and, with a label, a :text at its top left. An edge the scale
places nowhere draws nothing for its datum. The fill is a function, an atom field, or a
color value; the label a function, an atom field, or a string.
Summary
Functions
Sets the fill: a function, an atom field, or a color value; nil unsets it.
One :group element per drawn datum: the rectangle, then the label when there is one.
Sets the label: a function, an atom field, or a string; nil clears it.
An x-band reading tuple elements 0 and 1 as its edges, extent 0 to 100, the brush's fill.
Sets the x scale the edges map through; nil means the values are pixels.
Sets the first edge's domain value accessor: a function, a field, or a number.
Sets the second edge's domain value accessor: a function, a field, or a number.
Sets the first vertical extent accessor: a function, a field, or a number.
Sets the second vertical extent accessor: 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 :group element per drawn datum: the rectangle, then the label when there is one.
Sets the label: a function, an atom field, or a string; nil clears it.
@spec new() :: t()
An x-band reading tuple elements 0 and 1 as its edges, extent 0 to 100, the brush's fill.
Sets the x scale the edges map through; nil means the values are pixels.
Sets the first edge's domain value accessor: a function, a field, or a number.
Sets the second edge's domain value accessor: a function, a field, or a number.
Sets the first vertical extent accessor: a function, a field, or a number.
Sets the second vertical extent accessor: a function, a field, or a number.