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

Copy Markdown View Source

The builder's preview pane: the stacked design drawn, or its faults (spec/14 §18.4).

The pane draws through the ordinary path — Visualize.Chart.apply/2 over the pool of sample sources and the variables, then Visualize.Chart.render/2 — so what a person sees while editing and what the host is handed on save cannot differ. Where application reports faults the pane lists them instead, one line per error as Visualize.Chart.Validator.format/1 renders it and in the validator's order: an incomplete design is the normal state of one being built, so the error list is a panel of the tool and not an error page.

A fault the frame raises rather than reports — a value a scale cannot take, a theme name nothing resolves — raises here as it does anywhere else (spec/14 §7.3): those are faults of the host's data, and catching them would hide a bug in the host.

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

Summary

Functions

Renders the preview pane (spec/10 §15.3).

Functions

panel(assigns)

Renders the preview pane (spec/10 §15.3).

<div class="vis-builder-preview"> holding either the chart's markup or <ul class="vis-builder-errors"> with one <li class="vis-builder-error"> per fault. Exactly one of the two is present; beneath either, the steps the chart still has to take as <ol class="vis-builder-steps">, each a button (spec/14 §18.4, #374). The chart is drawn with paths: true, so every node it draws carries data-node, and the <svg> carries data-builder-selected with the open node's label (spec/14 §18.4, §18.16).

Attributes

  • design (:map) (required) - the stacked design to draw.
  • sources (:map) - the pool the design's slots bind to. Defaults to %{}.
  • vars (:map) - the values the design's variables take. Defaults to %{}.
  • theme (:any) - a Visualize.Theme, nil for the design's own. Defaults to nil.
  • class (:string) - appended to the pane's class. Defaults to nil.
  • selected (:string) - the open node's label, carried on the <svg> for the graph's hook (spec/14 §18.4). Defaults to nil.
  • steps (:list) - what the chart still needs, as Visualize.Chart.Builder.Steps.steps/1 gives it (#374). Defaults to [].
  • target (:any) - the phx-target of a step's button. Defaults to nil.