vega-lite-api

vl.mark(…mark)

Create a new mark of unspecified type.

The behavior of this method depends on the argument type:

mark Method Overview

mark API Reference

# mark.align(value)

The alignment to apply to grid rows and columns. The supported string values are "all", "each", and "none".

Alternatively, an object value of the form {"row": string, "column": string} can be used to supply different alignments for rows and columns.

Default value: "all".

# mark.autosize(value)

How the visualization size should be determined. If a string, should be one of "pad", "fit" or "none". Object values can additionally specify parameters for content sizing and automatic resizing.

Default value: pad

# mark.background(value)

CSS color property to use as the background of the entire view.

Default value: "white"

# mark.bounds(value)

The bounds calculation method to use for determining the extent of a sub-plot. One of full (the default) or flush.

Default value: "full"

# mark.center(value)

Boolean flag indicating if subviews should be centered relative to their respective rows or columns.

An object value of the form {"row": boolean, "column": boolean} can be used to supply different centering values for rows and columns.

Default value: false

# mark.config(value)

Vega-Lite configuration object. This property can only be defined at the top-level of a specification.

# mark.data(data)

The input data specification.

The behavior of this method depends on the argument type:

# mark.datasets(value)

A global data store for named datasets. This is a mapping from names to inline datasets. This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a data property.

# mark.description(value)

Description of this mark for commenting purpose.

# mark.encode(…encoding)

Specify visual encodings for the mark.

# mark.facet(…values)

Facet a chart into sub-plots by partitioning data values.

# mark.height(value)

The height of a visualization.

Default value: Based on config.view.continuousHeight for a plot with a continuous y-field and config.view.discreteHeight otherwise.

Note: For plots with row and column channels, this represents the height of a single view and the "container" option cannot be used.

See also: height documentation.

# mark.mark(…mark)

Set the mark type and default visual properties.

The behavior of this method depends on the argument type:

# mark.markArc(…mark)

Create a new arc mark based on this mark.

# mark.markArea(…mark)

Create a new area mark based on this mark.

# mark.markBar(…mark)

Create a new bar mark based on this mark.

# mark.markBoxplot(…mark)

Create a new boxplot mark based on this mark.

# mark.markCircle(…mark)

Create a new circle mark based on this mark.

# mark.markErrorband(…mark)

Create a new errorband mark based on this mark.

# mark.markErrorbar(…mark)

Create a new errorbar mark based on this mark.

# mark.markGeoshape(…mark)

Create a new geoshape mark based on this mark.

# mark.markImage(…mark)

Create a new image mark based on this mark.

# mark.markLine(…mark)

Create a new line mark based on this mark.

# mark.markPoint(…mark)

Create a new point mark based on this mark.

# mark.markRect(…mark)

Create a new rect mark based on this mark.

# mark.markRule(…mark)

Create a new rule mark based on this mark.

# mark.markSquare(…mark)

Create a new square mark based on this mark.

# mark.markText(…mark)

Create a new text mark based on this mark.

# mark.markTick(…mark)

Create a new tick mark based on this mark.

# mark.markTrail(…mark)

Create a new trail mark based on this mark.

# mark.name(value)

Name of the visualization for later reference.

# mark.padding(value)

The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. If an object, the value should have the format {"left": 5, "top": 5, "right": 5, "bottom": 5} to specify padding for each side of the visualization.

Default value: 5

# mark.params(…params)

An array of parameters that may be simple variables or more complex selections that map user input to data queries.

# mark.project(projection)

The cartographic projection to apply to geographical data.

# mark.render(…values)

Compile and render the Vega-Lite visualization and return the DOM element containing the Vega View.

# mark.repeat(…values)

Repeat a chart template to generate multiple plots.

# mark.resolve(value)

Scale, axis, and legend resolutions for view composition specifications.

# mark.select(…params)

An array of parameters that may be simple variables or more complex selections that map user input to data queries. This method provides backwards compatiblity with earlier API versions; it is deprecated and may be removed in future versions. Use params() instead.

# mark.spacing(value)

The spacing in pixels between sub-views of the composition operator. An object of the form {"row": number, "column": number} can be used to set different spacing values for rows and columns.

Default value: Depends on "spacing" property of the view composition configuration (20 by default)

# mark.title(value)

Title for the plot.

# mark.toSpec(…values)

Return the Vega-Lite specification as a JavaScript object.

# mark.toString(…values)

Return the Vega-Lite specification as a JSON string.

# mark.toView(…values)

Compile the Vega-Lite specification and return the resulting Vega View object.

# mark.transform(…transform)

The data transformations to apply.

# mark.usermeta(value)

Optional metadata that will be passed to Vega. This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.

# mark.view(value)

An object defining the view background’s fill and stroke.

Default value: none (transparent)

# mark.width(value)

The width of a visualization.

Default value: Based on config.view.continuousWidth for a plot with a continuous x-field and config.view.discreteWidth otherwise.

Note: For plots with row and column channels, this represents the width of a single view and the "container" option cannot be used.

See also: width documentation.