Package smile.plot.vega
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
-
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.void
show()
Displays the plot with the default browser.void
show
(boolean silent) Displays the plot with the default browser.com.fasterxml.jackson.databind.node.ObjectNode
spec()
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. -
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. -
viewConfig
Returns the configuration object defining the style of a single view visualization. -
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. -
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. -
background
Sets the background of the entire view with CSS color property. -
padding
Specifies padding for all sides. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle. -
padding
Specifies padding for each side. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle. -
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. -
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.
-
name
Sets the name of the visualization for later reference. -
description
Sets the description of this mark for commenting purpose. -
title
Sets a descriptive title to a chart.- Parameters:
title
- a descriptive title.- Returns:
- this object.
-
data
Returns the data specification object.- Returns:
- the data specification object.
-
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
HeadlessException
-
show
Displays the plot with the default browser.- Parameters:
silent
- If true, silently swallow any exception.- Throws:
IOException
HeadlessException
-
html
Returns the HTML of plot specification with Vega Embed.- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
html
Returns the HTML of plot specification with Vega Embed.- Parameters:
lang
- the primary language of document.- Returns:
- the HTML of plot specification with Vega Embed.
-
iframe
Returns the HTML wrapped in an iframe to render in notebooks.- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-
iframe
Returns the HTML wrapped in an iframe to render in notebooks.- Parameters:
id
- the iframe HTML id.- Throws:
com.fasterxml.jackson.core.JsonProcessingException
-