Macaw.Frame.Coordinates.Facet (macaw_frame v0.1.0)

Copy Markdown View Source

The facet model (spec/03 §10): small multiples by a field, over any registered model.

  • What it owns (§10.1): facet, a node of by (a role every faceted slot binds), columns (at least 1, nil for one row) and model (the inner model's name, "cartesian" by default; a facet of a facet is {:invalid_for, :facet}).
  • Panels (§10.2): the distinct values of by over the layers' rows in order of first appearance, one panel with nothing delivered; they tile the plot in columns columns, each w / columns by h / rows. The inner model realizes once over the panel plot and every layer's rows, so every inferring scale's domain is shared and every panel is drawn to the same axes (a geographic inner model fits all panels' points once). Each panel is a group class="mw-panel" translated to its cell holding the inner model's grid, layers and axes, and its value at its top-left in the label style, by its declared name where the schema has one. The legend and the frame's labels are drawn once over the whole plot.
  • Hit-testing, writes and summary (§10.3): a point resolves to its panel by cell, then to the inner model at the panel's origin; writes and local keys are the inner model's, shared by every panel; the summary says "small multiples of" the inner kind.

Copied from visualize's Visualize.Chart.Frame (:facet, panels/4), over any model.

Summary

Functions

A plot pixel resolved to its panel by cell, then to the inner model at the panel's origin (§10.3): {:ok, {panel_value, domain_point}}, or :none.

Each panel as a group class="mw-panel" translated to its cell (§10.2): the inner model's grid, the panel's layers (layers maps a panel's value to its layer elements, each culled and clipped to the panel when the frame clips), the inner axes, and the panel's value at its top-left, by its declared name (opts[:names], value to name).

The panels in order (§10.2): each %{value, x, y, width, height}, its cell in the plot.

Functions

invert(model, arg2)

A plot pixel resolved to its panel by cell, then to the inner model at the panel's origin (§10.3): {:ok, {panel_value, domain_point}}, or :none.

panel_groups(model, layers, opts)

@spec panel_groups(Macaw.Frame.Coordinates.Model.t(), map(), keyword()) ::
  {:ok, [Macaw.Draw.IR.Element.t()]} | {:error, list()}

Each panel as a group class="mw-panel" translated to its cell (§10.2): the inner model's grid, the panel's layers (layers maps a panel's value to its layer elements, each culled and clipped to the panel when the frame clips), the inner axes, and the panel's value at its top-left, by its declared name (opts[:names], value to name).

panels(model)

@spec panels(Macaw.Frame.Coordinates.Model.t()) :: [map()]

The panels in order (§10.2): each %{value, x, y, width, height}, its cell in the plot.