Gap breaking over packed columns (spec/04 §6), copied from visualize's
Visualize.Board.Rows without the board's state and named for the frame.
A series is placed by its window field and broken at every gap longer than the
source's continuity, or the delivery's resolution if that is larger. This is a property
of the line, area and percentile_band kinds, read from the delivery and the slot's
schema:
- The axis: the field the layer's
xreads, when it is the slot's window field; for a line over aprojectionstep's pixels (a route), the slot's window field, its value fields the projected longitude and latitude. Any other layer whosexis not the window field is not gap-broken. - Order: rows in window-field order; a delivery whose window column is already non-decreasing is used as it is, otherwise a stable sort permutation of the column. The delivery is never rewritten.
- Series: gaps are measured within a series: the layer's
seriesfield, else the slot's declared identity, else the whole delivery. - The threshold, per value field:
max(continuity, resolution), the field's schemacontinuityand the delivery'sserved.resolution(a number as it is, a name as its seconds, an unknown name ornilas0). A field with nocontinuitynever breaks. - The measure: an instant in seconds, a number as itself (
Macaw.Frame.Layer.Device .measure/1). - The break is a mask (
gap):trueat a row a gap precedes in its series, where its window reading and the previous placed row's differ by more than any of its value fields' thresholds. No row is inserted.
of/3 is one pass over the window column per series, linear in the rows; the Frame keeps
its answer per delivery.
Summary
Functions
The rows a gap precedes, ascending (§6): [] where nothing breaks. What a layer drawing
from its pixel binaries splits its runs at.
Whether a row's gap mask says a gap precedes it.
A layer's window order and gaps over its table (§6). values are the value channels the
layer reads (["y"] for a line). order is the rows' indices in window order, nil when
the layer is not placed by a window field (its rows as they are); gap a tuple with one
boolean per row, true where a gap precedes it, nil where nothing breaks.
The rows' indices in drawing order: the window order, else the delivery's.
A delivery's resolution in the window field's units (§6.4): a number as it is, a name as
its seconds, an unknown name or nil as 0.
Types
@type t() :: %Macaw.Frame.Gaps{ gap: tuple() | MapSet.t(non_neg_integer()) | nil, order: [non_neg_integer()] | nil, window: String.t() | nil }
Functions
@spec breaks(t()) :: [non_neg_integer()]
The rows a gap precedes, ascending (§6): [] where nothing breaks. What a layer drawing
from its pixel binaries splits its runs at.
@spec gap?(t(), non_neg_integer()) :: boolean()
Whether a row's gap mask says a gap precedes it.
@spec of(map(), Macaw.Data.Table.t(), [String.t()]) :: t()
A layer's window order and gaps over its table (§6). values are the value channels the
layer reads (["y"] for a line). order is the rows' indices in window order, nil when
the layer is not placed by a window field (its rows as they are); gap a tuple with one
boolean per row, true where a gap precedes it, nil where nothing breaks.
iex> {:ok, schema} = Macaw.Data.Schema.new(%{"t" => %{type: :number, window: true},
...> "v" => %{type: :number, continuity: 5}})
iex> {:ok, table} = Macaw.Data.Table.from([%{"t" => 12, "v" => 3}, %{"t" => 0, "v" => 1}, %{"t" => 2, "v" => 2}])
iex> layer = %{"channels" => %{"x" => {:field, "t"}, "y" => {:field, "v"}}, "context" => %{schema: schema}}
iex> gaps = Macaw.Frame.Gaps.of(layer, table, ["y"])
iex> {gaps.order, gaps.gap}
{[1, 2, 0], {true, false, false}}
@spec order(t(), non_neg_integer()) :: [non_neg_integer()]
The rows' indices in drawing order: the window order, else the delivery's.
A delivery's resolution in the window field's units (§6.4): a number as it is, a name as
its seconds, an unknown name or nil as 0.
iex> {Macaw.Frame.Gaps.resolution("hour"), Macaw.Frame.Gaps.resolution(15), Macaw.Frame.Gaps.resolution(nil)}
{3600, 15, 0}