VegaLite.Export (VegaLite v0.1.6) View Source

Various export methods for a VegaLite specification.

All of the export functions depend on the :jason package. Additionally the PNG, SVG and PDF exports rely on npm packages, so you will need Node.js, npm, and the following dependencies:

npm install -g vega vega-lite canvas
# or in the current directory
npm install vega vega-lite canvas

Link to this section Summary

Functions

Saves a VegaLite specification to file in one of the supported formats.

Builds an HTML page that renders the given graphic.

Returns the underlying Vega-Lite specification as JSON.

Renders the given graphic into a PDF and returns its binary content.

Renders the given graphic as a PNG image and returns its binary content.

Renders the given graphic as an SVG image and returns its binary content.

Link to this section Functions

Link to this function

run_cmd(script_path, args)

View Source
Link to this function

save!(vl, path, opts \\ [])

View Source

Specs

save!(VegaLite.t(), binary(), keyword()) :: :ok

Saves a VegaLite specification to file in one of the supported formats.

Options

  • :format - the format to export the graphic as, must be either of: :json, :html, :png, :svg, :pdf. By default the format is inferred from the file extension.

Specs

to_html(VegaLite.t()) :: binary()

Builds an HTML page that renders the given graphic.

The HTML page loads necessary JavaScript dependencies from a CDN and then renders the graphic in a root element.

Specs

to_json(VegaLite.t()) :: String.t()

Returns the underlying Vega-Lite specification as JSON.

Specs

to_pdf(VegaLite.t()) :: binary()

Renders the given graphic into a PDF and returns its binary content.

Relies on the npm packages mentioned above.

Specs

to_png(VegaLite.t()) :: binary()

Renders the given graphic as a PNG image and returns its binary content.

Relies on the npm packages mentioned above.

Specs

to_svg(VegaLite.t()) :: binary()

Renders the given graphic as an SVG image and returns its binary content.

Relies on the npm packages mentioned above.