View Source VegaLite.Export (VegaLite v0.1.9)
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
Alternatively you can install the dependencies in a local directory:
$ npm install vega vega-lite canvas
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.
Functions
@spec 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.:local_npm_prefix
- a relative path pointing to a local npm project directory where the necessary npm packages are installed. For instance, in Phoenix projects you may want to passlocal_npm_prefix: "assets"
. By default the npm packages are searched for in the current directory and globally.
@spec 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.
@spec to_json(VegaLite.t()) :: String.t()
Returns the underlying Vega-Lite specification as JSON.
@spec to_pdf( VegaLite.t(), keyword() ) :: binary()
Renders the given graphic into a PDF and returns its binary content.
Relies on the npm
packages mentioned above.
Options
:local_npm_prefix
- a relative path pointing to a local npm project directory where the necessary npm packages are installed. For instance, in Phoenix projects you may want to passlocal_npm_prefix: "assets"
. By default the npm packages are searched for in the current directory and globally.
@spec to_png( VegaLite.t(), keyword() ) :: binary()
Renders the given graphic as a PNG image and returns its binary content.
Relies on the npm
packages mentioned above.
Options
:local_npm_prefix
- a relative path pointing to a local npm project directory where the necessary npm packages are installed. For instance, in Phoenix projects you may want to passlocal_npm_prefix: "assets"
. By default the npm packages are searched for in the current directory and globally.
@spec to_svg( VegaLite.t(), keyword() ) :: binary()
Renders the given graphic as an SVG image and returns its binary content.
Relies on the npm
packages mentioned above.
Options
:local_npm_prefix
- a relative path pointing to a local npm project directory where the necessary npm packages are installed. For instance, in Phoenix projects you may want to passlocal_npm_prefix: "assets"
. By default the npm packages are searched for in the current directory and globally.