Class VegaLite
java.lang.Object
smile.plot.vega.VegaLite
Vega-Lite specifications are JSON objects that describe a diverse range
of interactive visualizations. Besides using a single view specification
as a standalone visualization, Vega-Lite also provides operators for
composing multiple view specifications into a layered or multi-view
specification. These operators include layer, facet, concat, and repeat.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionautosize()Sets the overall size of the visualization.Sets the overall size of the visualization.background(String color) Sets the background of the entire view with CSS color property.config()Returns the configuration object that lists properties of a visualization for creating a consistent theme.data()Returns the data specification object.description(String description) Sets the description of this mark for commenting purpose.html()Returns the HTML of plot specification with Vega Embed.Returns the HTML of plot specification with Vega Embed.iframe()Returns the HTML wrapped in an iframe to render in notebooks.Returns the HTML wrapped in an iframe to render in notebooks.Sets the name of the visualization for later reference.padding(int size) Specifies padding for all sides.padding(int left, int top, int right, int bottom) Specifies padding for each side.voidshow()Displays the plot with the default browser.voidshow(boolean silent) Displays the plot with the default browser.com.fasterxml.jackson.databind.node.ObjectNodespec()Returns the Vega-Lite specification.Sets a descriptive title to a chart.Returns the specification in pretty print.toString()Returns the data transformation object.usermeta(com.fasterxml.jackson.databind.JsonNode metadata) Optional metadata that will be passed to Vega.Optional metadata that will be passed to Vega.Returns the configuration object defining the style of a single view visualization.
-
Constructor Details
-
VegaLite
public VegaLite()Constructor.
-
-
Method Details
-
toString
-
toPrettyString
Returns the specification in pretty print.- Returns:
- the specification in pretty print.
-
spec
public com.fasterxml.jackson.databind.node.ObjectNode spec()Returns the Vega-Lite specification.- Returns:
- the Vega-Lite specification.
-
config
Returns the configuration object that lists properties of a visualization for creating a consistent theme. This property can only be defined at the top-level of a specification.- Returns:
- the configuration object.
-
viewConfig
Returns the configuration object defining the style of a single view visualization.- Returns:
- the view configuration object.
-
usermeta
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.- Parameters:
metadata- the metadata.- Returns:
- this object.
-
usermeta
-
background
-
padding
Specifies padding for all sides. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.- Parameters:
size- the padding size.- Returns:
- this object.
-
padding
Specifies padding for each side. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle.- Parameters:
left- the left padding.top- the top padding.right- the right padding.bottom- the bottom padding.- Returns:
- this object.
-
autosize
Sets the overall size of the visualization. The total size of a Vega-Lite visualization may be determined by multiple factors: specified width, height, and padding values, as well as content such as axes, legends, and titles.- Returns:
- this object.
-
autosize
Sets the overall size of the visualization. The total size of a Vega-Lite visualization may be determined by multiple factors: specified width, height, and padding values, as well as content such as axes, legends, and titles.- Parameters:
type- The sizing format type. One of "pad", "fit", "fit-x", "fit-y", or "none". See Vega-Lite documentation for descriptions of each.resize- A boolean flag indicating if autosize layout should be re-calculated on every view update.contains- Determines how size calculation should be performed, one of "content" or "padding". The default setting ("content") interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the "padding" setting includes the padding within the view size calculations, such that the width and height settings indicate the total intended size of the view.- Returns:
- this object.
- See Also:
-
name
-
description
-
title
-
data
-
transform
Returns the data transformation object. such as filter and new field calculation. Data transformations in Vega-Lite are described via either view-level transforms (the transform property) or field transforms inside encoding (bin, timeUnit, aggregate, sort, and stack).When both types of transforms are specified, the view-level transforms are executed first based on the order in the array. Then the inline transforms are executed in this order: bin, timeUnit, aggregate, sort, and stack.
- Returns:
- the data transformation object.
-
show
Displays the plot with the default browser.- Throws:
IOException- if fails to create html file of plot.HeadlessException- if the VM runs in headless mode.
-
show
Displays the plot with the default browser.- Parameters:
silent- If true, silently swallow any exception.- Throws:
IOException- if fails to create html file of plot.HeadlessException- if the VM runs in headless mode.
-
html
Returns the HTML of plot specification with Vega Embed.- Returns:
- the HTML of plot specification with Vega Embed.
-
html
-
iframe
Returns the HTML wrapped in an iframe to render in notebooks.- Returns:
- the HTML wrapped in an iframe to render in notebooks.
-
iframe
-