A vertical rule at a domain value, with an optional label (spec/07 §12), copied from
visualize's Visualize.Shape.Rule: an instant (a deploy, an incident) inside the same
scale and plot as the data.
x/2 yields a domain value that scale/2 maps, any scale
Macaw.Draw.Scale.apply/2 takes; with no scale the value is a pixel. new/0 reads
each datum as its own value, so a list of bare values is valid data:
iex> alias Macaw.Draw.Shape.Rule
iex> [group] = Rule.generate(Rule.new(), [33])
iex> [line] = group.children
iex> {group.style, line.attrs}
{%{class: "rule"}, %{x1: 33, y1: 0, x2: 33, y2: 100}}generate/2 answers one :group per datum, style: %{class: "rule"}: a :line from
(px, y0) to (px, y1) and, with a label, a :text right of the rule's upper end. A
value the scale places nowhere draws nothing for its datum. The label is a function, an
atom field, or a string; nil clears it.
Summary
Functions
One :group element per drawn datum: the line, then the label when there is one.
Sets the label: a function, an atom field, or a string; nil clears it.
A rule reading each datum as its own x value, with extent 0 to 100.
Sets the x scale the values map through; nil means the values are pixels.
Sets the 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
@spec generate(t(), [term()]) :: [Macaw.Draw.IR.Element.t()] | error()
One :group element per drawn datum: the line, then the label when there is one.
Sets the label: a function, an atom field, or a string; nil clears it.
@spec new() :: t()
A rule reading each datum as its own x value, with extent 0 to 100.
Sets the x scale the values map through; nil means the values are pixels.
Sets the 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.