The data page (spec/14 §19.10, #372): what the sources root shows — one row per source
of the composed design, its name, its columns with their types, and its generator while
designing (a Visualize.Signals signal under the source's name) or the host's rows.
One list, one name: a signal's fields are always its source's fields, written from
the row, so the two cannot drift. This module renders; the builder holds the design,
the signals and the tick.
This module compiles only when Phoenix.Component is loaded (spec/10 §1.1, D-45, D-85).
Summary
Functions
A signal edited by one number of the page (spec/14 §19.10): window, period, min,
max or seed; anything unreadable leaves the signal as it is. A signal's kind and
fields are the row's — set_generator and the columns — not this.
Renders the data page.
The page's rows (spec/14 §19.10, #372), sorted by name: for every source the composed
design declares, its columns — each with the type the design gives it and, when it
gives none, what the rows suggest — its signal's kind and numbers when it has one, the
host's row count, and its default. owners maps a source's name to the layer that
declares it, shown beside the name.
Functions
@spec edit(Visualize.Signals.t(), String.t(), String.t()) :: Visualize.Signals.t()
A signal edited by one number of the page (spec/14 §19.10): window, period, min,
max or seed; anything unreadable leaves the signal as it is. A signal's kind and
fields are the row's — set_generator and the columns — not this.
iex> s = Visualize.Signals.new(:sine, [:t, :v])
iex> Visualize.Chart.Builder.Sources.edit(s, "window", "12").window
12
iex> Visualize.Chart.Builder.Sources.edit(s, "window", "none") == s
true
iex> Visualize.Chart.Builder.Sources.edit(s, "fields", "a, b") == s
true
Renders the data page.
Attributes
id(:string) (required) - the panel's id.rows(:list) (required) - the page's rows, asrows/5gives them.tick(:integer) - the tick the pool stands at. Defaults to0.playing(:boolean) - whether the tick advances. Defaults tofalse.tick_ms(:integer) - the tick's period. Defaults to500.pool(:list) - the host's pool names, for a source's default. Defaults to[].defaults?(:boolean) - whether a source'sdefaultis offered. Defaults totrue.target(:any) - thephx-targetof the panel's events. Defaults tonil.
@spec rows(map(), %{required(atom()) => Visualize.Signals.t()}, map(), map(), %{ required(atom()) => term() }) :: [map()]
The page's rows (spec/14 §19.10, #372), sorted by name: for every source the composed
design declares, its columns — each with the type the design gives it and, when it
gives none, what the rows suggest — its signal's kind and numbers when it has one, the
host's row count, and its default. owners maps a source's name to the layer that
declares it, shown beside the name.
iex> design = %{sources: %{feed: %{fields: [:t, :v], types: %{t: :time}}}}
iex> signals = %{feed: Visualize.Signals.new(:sine, [:t, :v], window: 8)}
iex> [row] = Visualize.Chart.Builder.Sources.rows(design, signals, %{}, %{}, %{})
iex> {row.name, Enum.map(row.columns, &{&1.name, &1.type}), row.signal.kind, row.signal.numbers}
{"feed", [{"t", :time}, {"v", nil}], :sine, [window: 8, period: 12, min: 0, max: 100, seed: 0]}
iex> [row] = Visualize.Chart.Builder.Sources.rows(design, %{}, %{feed: [%{t: 1, v: 2, w: 3}]}, %{feed: %{t: :number, v: :number, w: :number}}, %{})
iex> {row.picks, row.host_rows, Enum.map(row.columns, & &1.suggested)}
{["w"], 1, [nil, :number]}