Visualize.Chart.Builder.Document (Visualize v0.2.35)

Copy Markdown View Source

The builder's import and export: the design's JSON form, in and out (spec/14 §18.12).

Export is Visualize.Chart.to_json/1 of the stacked design, and it therefore demands a design: the stack goes through Visualize.Chart.from_map/1 first, and a fragment that does not validate is its errors, listed by path exactly as the preview lists them. Import reads a pasted document through Visualize.Chart.from_json/1, and the design it yields becomes the builder's single layer, since a document is a whole design and not a layer of somebody else's stack (D-88).

Both are behind the optional Jason dependency: without it each reports {:missing_dependency, :jason} in the panel rather than raising, which is what an optional dependency means.

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

Summary

Functions

Renders the import and export panel (spec/10 §15.3).

Functions

panel(assigns)

Renders the import and export panel (spec/10 §15.3).

The exported document, or the faults that stop it, and a form that reads one back.

Attributes

  • id (:string) - the panel's id, and the stem of its import form's. Defaults to "vis-builder-document".
  • design (:map) (required) - the stacked design to encode.
  • kind (:atom) - what the stack is of: a composite, or one kind. Defaults to :composite.
  • target (:any) - the phx-target of the form's events. Defaults to nil.
  • class (:string) - appended to the panel's class. Defaults to nil.