Learn R Programming

vegalite (version 0.6.1)

from_spec: Take a JSON Vega-Lite Spec and render as an htmlwidget

Description

Vega-Lite is - at the core - a JSON "Grammar of Graphics" specification for how to build a data- & stats-based visualization. While Vega & D3 are the main targets, the use of Vega-Lite does not have to be restricted to just D3. For now, this function takes in a JSON spec (full text or URL) and renders it as an htmlwidget. Data should either be embedded or use a an absolute URL reference.

Usage

from_spec(spec, width = NULL, height = NULL, renderer = c("svg", "canvas"), export = FALSE, source = FALSE, editor = FALSE)

Arguments

spec
URL to a Vega-Lite JSON file or the JSON text of a spec
width, height
widget width/height
renderer
the renderer to use for the view. One of canvas or svg (the default)
export
if TRUE the "Export as..." link will be displayed with the chart.(Default: FALSE.)
source
if TRUE the "View Source" link will be displayed with the chart. (Default: FALSE.)
editor
if TRUE the "Open in editor" link will be displayed with the cahrt. (Default: FALSE.)

Examples

Run this code
from_spec("http://rud.is/dl/embedded.json")

Run the code above in your browser using DataLab