Skip to contents

Add data to a vega-lite spec

Usage

vl_add_data(
  spec,
  values = NULL,
  format = NULL,
  name = NULL,
  url = NULL,
  graticule = NULL,
  sequence = NULL,
  sphere = NULL,
  .object = NULL
)

Arguments

spec

An input vega-lite spec

values

The full data set, included inline. This can be an array of objects or primitive values, an object, or a string. Arrays of primitive values are ingested as objects with a data property. Strings are parsed according to the specified format type.

format

An object that specifies the format for parsing the data.

name

Provide a placeholder name and bind data at runtime.

Or: Provide a placeholder name and bind data at runtime.

New data may change the layout but Vega does not always resize the chart. To update the layout when the data updates, set autosize or explicitly use view.resize.

url

An URL from which to load the data set. Use the format.type property to ensure the loaded data is correctly parsed.

graticule

Generate graticule GeoJSON data for geographic reference lines.

sequence

Generate a sequence of numbers.

sphere

Generate sphere GeoJSON data for the full globe.

.object

Directly input an object, rather than creating one via the other arguments. Should not be used in conjunction with the other arguments other than spec. Objects can be of type: UrlData, InlineData, NamedData, SequenceGenerator, SphereGenerator or GraticuleGenerator

Value

A modified Vega-Lite Spec