The data pipeline of a mark (spec/14 §5.4, D-62): filtering, binning, stacking,
aggregation, the layouts of Visualize.Layout and the geo algorithms as %{op: …}
steps over rows.
apply/3 runs the steps of a mark's data.transforms in order over its source's rows,
each a pure function of the rows before it and its node, and yields the rows the mark
draws. Its only context is the plot area (size:, the extent every layout defaults
to), the point a centred mark is about (centre:), in a :geo frame the projection
(projection:), the instant a :window step measures back from (now:), and the
realisation's laid-out :force steps (forces:, spec/14 §5.4.3, D-132) — never a
scale, which is what lets Visualize.Chart.Frame.new/2 run the pipeline before its
scales exist and infer their domains from the transformed columns. A layout's rows carry
their shape as a Visualize.IR.Path under path, which the :path mark draws as it is.
Examples
iex> rows = [%{v: 1}, %{v: 2}, %{v: 2}, %{v: 9}]
iex> Visualize.Chart.Transform.apply([%{op: :bin, field: :v, thresholds: [5]}], rows)
[%{x0: 1, x1: 5, y0: 0, count: 3, values: [1, 2, 2]}, %{x0: 5, x1: 9, y0: 0, count: 1, values: [9]}]
Summary
Types
What a step sees of the frame: the plot area, in a :geo frame its projection, the bound sources for a graph's node table, the instant a :window measures back from, and the realisation's force layouts.
Types
@type context() :: %{ size: [number()], centre: [number()], projection: Visualize.Geo.Projection.t() | nil, sources: map(), now: term() | nil, forces: map() }
What a step sees of the frame: the plot area, in a :geo frame its projection, the bound sources for a graph's node table, the instant a :window measures back from, and the realisation's force layouts.
Functions
@spec apply([map()], Visualize.Data.Table.source(), keyword()) :: [map()]
The rows after every transform node, in order (spec/14 §5.4).
Options
:size- the[width, height]the layouts and the geo algorithms default to, and whose width an:lttbstep'sn: :plotand an:m4step'swidth: :plotread (default[1, 1]):centre- the[x, y]a:chordstep's paths are about: the point an:arcmark is about, which the frame passes (spec/14 §5.4.3, #488);sizesets the chord's radius, never its centre (default the middle of:size):projection- the%Visualize.Geo.Projection{}a:projectionstep maps through (defaultnil):sources- the bound sources by name, for a graph step'snodes(default%{}):now- the instant a:windowstep measures its durations back from (spec/14 §5.4.1); without it each such step takes the newest reading of its own column:forces- the:forcesteps a realisation has laid out, by run (spec/14 §5.4.3, D-132): whatVisualize.Chart.Frame.new/2passes, so the marks of one graph read one layout; a step not among them runs cold (default%{})
Raises ArgumentError for an op that is not one of spec/14 §5.4, a key an op requires
and the node lacks, or a :projection step without a projection.
@spec step(map(), Visualize.Data.Table.source(), keyword()) :: [map()]
One step of apply/3: the rows after the transform node.