The drawing rules every layer kind shares (spec/04 §1.7), copied from visualize's
Visualize.Chart.Mark (the group), Visualize.Chart.Mark.Series, .Strokes,
.Styled and .Identity.
A kind's draw/3 builds its children, one per element it draws, each a map:
element- the generator's ownMacaw.Draw.IR.Element, so a layer is byte for byte the direct call with the same numbers;row- the row's index in the layer's rows, ornilfor an element no row draws;series- the series value the element draws, ornil;anchor- its inline label's anchor point{x, y}(§1.8.1),nilfor none;bounds-{x, y, w, h}of a rectangular element, for the edge anchors and the fit;extentthe width a label fits into,:nonefor any;radiian arc's radii;tail-truefor the provisional part of a cut path (§1.12).
and hands them to group/4, which applies every shared rule in one pass:
- Series (§1.7.2): each element of a series carries
data-series(to_string/1of the value) and is painted the series' color: the frame'scolorscale's value for it when the frame declares the scale (a value outside its domain takes the scale'sunknown), else the theme's series role for the series' position among the layer's series values; anything more specific wins. Anilseries names none. - Paint and parts (§1.7.3): the group carries the resolved style's keys of the
parts the kind declares, and its paint key: the style's, else the theme's series role
for the layer's position among the document's layers; a stroked kind takes
fill: none. A{:field, f}binding is read per element from its row; one readingnilisnone. Every color is a theme role or a value bound from data, which carries its cue (data-mw-cue). - Keys and identity (§1.7.5): every element drawn from a row carries
data-row; the group carriesdata-frameanddata-layer; a moving layer's elements carrydata-mw-id,<frame>.<layer>.<identity>. - Tooltip (§1.9): the datum attributes of each element's row, and the group's.
- Stroke placement (§1.7.4):
inside,outsideanddouble, drawn by the kind. - The polar bend: a kind that
bend?/0is bent by the model. - The group (§1.7.1): one group
class="mw-layer mw-layer-<kind>", or the wrapper of an elements group and a labels group when the layer has a label (Macaw.Frame.Layer.Label); a centered kind outside a polar frame translates its group to the plot's center.
Pixels are columns (§1.12): a kind zips the columns of Macaw.Frame.Layer.Read into
its children in one pass, and only an edge that names a row reads it, by index.
Summary
Functions
The group's class: mw-layer mw-layer-<kind>, then the style's own class.
The drawing context of a checked layer over its table in its model: the theme and mode,
the static style (its kind's parts), its bindings, its paint {key, color}, its series
values by position, the color scale and the label. A kind reads it to build its
children; group/4 reads it to apply the shared rules.
A color read from data, as drawn (spec/11 §8.2): the literal where it reaches 3:1
against the theme's background (Macaw.Layers.Theme.data_color/2), else the theme's
neutral, in the layer's mode.
The faults of the data colors a checked layer draws over table in model (spec/11
§8.2): each field bound to a fill or a stroke with no color scale between, whose first
value under the theme's 3:1 guard is {:data_color, field, reason} at the layer's
style. The column is read once, each distinct value judged once.
The layer's group of children (§1.7): every shared rule applied, in one pass over the
children, the labels of Macaw.Frame.Layer.Label beside them when the layer has a
label. {:ok, group}. Options: labels: text elements the kind lifts into the labels
group itself (a rule's and an x band's generator labels), paint: false for a kind
whose paint sits on its elements (a rule's line), center: true for a centered kind.
Whether a layer moves: its style carries motion, or it has a transition (§1.7.5).
What a provisional element draws in over its layer's style (§1.12, D-274): the style
named provisional, the design's entry over the theme's palette entry, laid at the
data-style layer; a dashed stroke and a half-opaque fill where neither names one. The
keys it changes, resolved in the layer's mode.
The cue of the role a reading has through the layer's color scale (spec/11 §8.1):
{:ok, %{glyph, dash}} where the scale maps the reading to one of the theme's roles
(Macaw.Layers.Theme.cue/1), :none otherwise.
A series value's color (§1.7.2): the color scale's value for it, or the theme's series role for its position among the layer's series values.
Types
@type child() :: %{ :element => Macaw.Draw.IR.Element.t(), optional(:row) => non_neg_integer() | nil, optional(:series) => term(), optional(:anchor) => tuple() | nil, optional(:bounds) => {number(), number(), number(), number()} | nil, optional(:extent) => number() | :none | nil, optional(:radii) => {number(), number()} | nil, optional(:tail) => boolean() }
One element a kind draws, with what the shared rules read of it.
Functions
The group's class: mw-layer mw-layer-<kind>, then the style's own class.
@spec context(map(), Macaw.Data.Table.t(), Macaw.Frame.Coordinates.Model.t()) :: map()
The drawing context of a checked layer over its table in its model: the theme and mode,
the static style (its kind's parts), its bindings, its paint {key, color}, its series
values by position, the color scale and the label. A kind reads it to build its
children; group/4 reads it to apply the shared rules.
A color read from data, as drawn (spec/11 §8.2): the literal where it reaches 3:1
against the theme's background (Macaw.Layers.Theme.data_color/2), else the theme's
neutral, in the layer's mode.
@spec data_color_faults( map(), Macaw.Data.Table.t(), Macaw.Frame.Coordinates.Model.t() ) :: [ {list(), term()} ]
The faults of the data colors a checked layer draws over table in model (spec/11
§8.2): each field bound to a fill or a stroke with no color scale between, whose first
value under the theme's 3:1 guard is {:data_color, field, reason} at the layer's
style. The column is read once, each distinct value judged once.
@spec group(map(), [child()], keyword()) :: {:ok, Macaw.Draw.IR.Element.t()}
The layer's group of children (§1.7): every shared rule applied, in one pass over the
children, the labels of Macaw.Frame.Layer.Label beside them when the layer has a
label. {:ok, group}. Options: labels: text elements the kind lifts into the labels
group itself (a rule's and an x band's generator labels), paint: false for a kind
whose paint sits on its elements (a rule's line), center: true for a centered kind.
Whether a layer moves: its style carries motion, or it has a transition (§1.7.5).
What a provisional element draws in over its layer's style (§1.12, D-274): the style
named provisional, the design's entry over the theme's palette entry, laid at the
data-style layer; a dashed stroke and a half-opaque fill where neither names one. The
keys it changes, resolved in the layer's mode.
The cue of the role a reading has through the layer's color scale (spec/11 §8.1):
{:ok, %{glyph, dash}} where the scale maps the reading to one of the theme's roles
(Macaw.Layers.Theme.cue/1), :none otherwise.
A series value's color (§1.7.2): the color scale's value for it, or the theme's series role for its position among the layer's series values.