Visualize.Chart.Builder.Steps (Visualize v0.2.25)

Copy Markdown View Source

What a new chart still needs (spec/14 §18.4, #374): data, a mark, axes — the builder's steps, never the validator's faults, so none blocks Save or Deploy nor badges a root. steps/1 reads the design; the preview draws them beneath the chart, each a button that does or opens the step.

This module compiles only when Phoenix.Component is loaded (spec/10 §1.1, D-45, D-85).

Summary

Types

One step: where it stands, its words, and the event that does or opens it.

Functions

The steps a composite still has to take, in the order a person meets them: no source declared, no mark, a mark reading a position scale while no axis measures any.

Types

step()

@type step() :: %{
  path: [atom()],
  words: String.t(),
  event: String.t(),
  values: %{required(String.t()) => String.t()}
}

One step: where it stands, its words, and the event that does or opens it.

Functions

steps(design)

@spec steps(map()) :: [step()]

The steps a composite still has to take, in the order a person meets them: no source declared, no mark, a mark reading a position scale while no axis measures any.

iex> Visualize.Chart.Builder.Steps.steps(%{frames: %{main: %{kind: :cartesian}}}) |> Enum.map(& &1.path)
[[:sources], [:marks]]
iex> design = %{frames: %{main: %{kind: :cartesian}}, sources: %{s: %{fields: [:t, :v]}},
...>   marks: [%{type: :line, data: :s, channels: %{x: :t, y: :v}}]}
iex> Visualize.Chart.Builder.Steps.steps(design) |> Enum.map(&{&1.path, &1.event})
[{[:frames, :main, :axes], "select_node"}]
iex> Visualize.Chart.Builder.Steps.steps(put_in(design, [:frames, :main, :axes], [%{scale: :x, side: :bottom}]))
[]