The ten LiveView components as stored designs (spec/14 §15, D-64).
Each preset is a function from a component's assigns — the keys of its table in spec/10,
an absent one taking defaults/1 — to a design map of spec/14: no function reaches the
map, because the accessor assigns are applied once by sources/2, the assign mapping,
into the rows the design's one source (data) binds to. Visualize.Components and
Visualize.Components.Tree render these designs through Visualize.Chart.Frame; a
design is also a value of its own, storable and bindable to any source with the same
columns.
Examples
iex> design =
...> Visualize.Chart.Presets.bar_chart(%{
...> data: [%{name: "a", value: 3}, %{name: "b", value: 5}],
...> x: & &1.name,
...> y: & &1.value
...> })
iex> design.frames.main.scales
%{x: %{kind: :band, padding: 0.1}, y: %{kind: :linear, domain: [0, :auto]}}
iex> hd(design.marks).channels
%{x0: :x, x1: :x, y0: 0, y1: :y}
iex> {:ok, _chart} = Visualize.Chart.from_map(design)
iex> Visualize.Chart.Presets.sources(
...> :bar_chart,
...> %{data: [%{name: "a", value: 3}], x: & &1.name, y: & &1.value}
...> )
%{data: [%{x: "a", y: 3}]}
Summary
Types
A component's assigns: the keys of its table in spec/10.
Functions
The area_chart design (spec/14 §15.3, spec/10 §2.7).
The bar_chart design (spec/14 §15.3, spec/10 §2.3).
The assigns a component's table defaults (spec/10 §2–3), as a map: the one place the
numbers live, which the components' attr/3 declarations read.
The design of the named preset: the function of that name over assigns.
The horizontal_bar_chart design (spec/14 §15.3, spec/10 §2.4).
The line_chart design (spec/14 §15.3, spec/10 §2.2).
The ten preset names in the order of spec/10 §2.1 and §3.1.
The pie_chart design (spec/14 §15.3, spec/10 §2.5).
The scatter_plot design (spec/14 §15.3, spec/10 §2.6).
The assign mapping (spec/14 §15.2): %{data: rows}, the rows the design's source binds
to — the accessor assigns applied to each row of data, or the nested map flattened to
one row per node for a hierarchy preset.
The stacked_bar_chart design (spec/14 §15.3, spec/10 §2.8).
The sunburst_chart design (spec/14 §15.4, spec/10 §3.4).
The tree_diagram design (spec/14 §15.4, spec/10 §3.2).
The treemap_chart design (spec/14 §15.4, spec/10 §3.3).
Types
A component's assigns: the keys of its table in spec/10.
@type name() ::
:line_chart
| :bar_chart
| :horizontal_bar_chart
| :pie_chart
| :scatter_plot
| :area_chart
| :stacked_bar_chart
| :tree_diagram
| :treemap_chart
| :sunburst_chart
A preset name: one of names/0.
Functions
The area_chart design (spec/14 §15.3, spec/10 §2.7).
The bar_chart design (spec/14 §15.3, spec/10 §2.3).
The assigns a component's table defaults (spec/10 §2–3), as a map: the one place the
numbers live, which the components' attr/3 declarations read.
The design of the named preset: the function of that name over assigns.
The horizontal_bar_chart design (spec/14 §15.3, spec/10 §2.4).
The line_chart design (spec/14 §15.3, spec/10 §2.2).
@spec names() :: [name()]
The ten preset names in the order of spec/10 §2.1 and §3.1.
The pie_chart design (spec/14 §15.3, spec/10 §2.5).
The scatter_plot design (spec/14 §15.3, spec/10 §2.6).
The assign mapping (spec/14 §15.2): %{data: rows}, the rows the design's source binds
to — the accessor assigns applied to each row of data, or the nested map flattened to
one row per node for a hierarchy preset.
The stacked_bar_chart design (spec/14 §15.3, spec/10 §2.8).
The sunburst_chart design (spec/14 §15.4, spec/10 §3.4).
The tree_diagram design (spec/14 §15.4, spec/10 §3.2).
The treemap_chart design (spec/14 §15.4, spec/10 §3.3).