Package smile.plot.vega
Class View
java.lang.Object
smile.plot.vega.VegaLite
smile.plot.vega.View
- Direct Known Subclasses:
Layer
Single view specification, which describes a view that uses a single
mark type to visualize the data.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionautosize()
Sets the overall size of the visualization.Sets the overall size of the visualization.Returns the view background's fill and stroke object.background
(String color) Sets the background of the entire view with CSS color property.description
(String description) Sets the description of this mark for commenting purpose.Returns the field object for encoding a channel.encodeDatum
(String channel, double datum) Sets a constant data value encoded via a scale.encodeDatum
(String channel, int datum) Sets a constant data value encoded via a scale.encodeDatum
(String channel, String datum) Sets a constant data value encoded via a scale.encodeValue
(String channel, double value) Sets an encoded constant visual value.encodeValue
(String channel, int value) Sets an encoded constant visual value.encodeValue
(String channel, String value) Sets an encoded constant visual value.height
(int height) Sets the height of a plot with a continuous y-field, or the fixed height of a plot a discrete y-field or no y-field.To enable responsive sizing on height.heightStep
(int step) For a discrete y-field, sets the height per discrete step.Returns the mark definition object.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.projection
(String type) Returns the defining properties of geographic projection, which will be applied to shape path for "geoshape" marks and to latitude and "longitude" channels for other marks.Sets a descriptive title to a chart.usermeta
(com.fasterxml.jackson.databind.JsonNode metadata) Optional metadata that will be passed to Vega.Optional metadata that will be passed to Vega.width
(int width) Sets the width of a plot with a continuous x-field, or the fixed width of a plot a discrete x-field or no x-field.To enable responsive sizing on width.widthStep
(int step) For a discrete x-field, sets the width per discrete step.
-
Constructor Details
-
View
public View()Constructor. -
View
Constructor.- Parameters:
title
- a descriptive title.
-
-
Method Details
-
width
Sets the width of a plot with a continuous x-field, or the fixed width of a plot a discrete x-field or no x-field. -
height
Sets the height of a plot with a continuous y-field, or the fixed height of a plot a discrete y-field or no y-field. -
width
To enable responsive sizing on width.- Parameters:
width
- it should be set to "container".
-
height
To enable responsive sizing on height.- Parameters:
height
- it should be set to "container".
-
widthStep
For a discrete x-field, sets the width per discrete step. -
heightStep
For a discrete y-field, sets the height per discrete step. -
mark
Returns the mark definition object.- Parameters:
type
- The mark type. This could a primitive mark type (one of "bar", "circle", "square", "tick", "line", "area", "point", "geoshape", "rule", and "text") or a composite mark type ("boxplot", "errorband", "errorbar").- Returns:
- the mark definition object.
-
background
Returns the view background's fill and stroke object. -
projection
Returns the defining properties of geographic projection, which will be applied to shape path for "geoshape" marks and to latitude and "longitude" channels for other marks.- Parameters:
type
- The cartographic projection to use.
-
encode
Returns the field object for encoding a channel.- Parameters:
channel
- Vega-Lite supports the following groups of encoding channels: - Position Channels: x, y, x2, y2, xError, yError, xError2, yError2 - Position Offset Channels: xOffset, yOffset - Polar Position Channels: theta, theta2, radius, radius2 - Geographic Position Channels: longitude, latitude, longitude2, latitude2 - Mark Property Channels: angle, color (and fill / stroke), opacity, fillOpacity, strokeOpacity, shape, size, strokeDash, strokeWidth - Text and Tooltip Channels: text, tooltip - Hyperlink Channel: href - Description Channel: description - Level of Detail Channel: detail - Key Channel: key - Order Channel: order - Facet Channels: facet, row, columnfield
- A string defining the name of the field from which to pull a data value. Dots (.) and brackets ([ and ]) can be used to access nested objects (e.g., "field": "foo.bar" and "field": "foo['bar']"). If field names contain dots or brackets but are not nested, you can use \\ to escape dots and brackets (e.g., "a\\.b" and "a\\[0\\]").- Returns:
- the field object for encoding the channel.
-
encodeValue
Sets an encoded constant visual value.- Parameters:
channel
- the encoding channel.value
- the constant visual value.- Returns:
- this object.
-
encodeValue
Sets an encoded constant visual value.- Parameters:
channel
- the encoding channel.value
- the constant visual value.- Returns:
- this object.
-
encodeValue
Sets an encoded constant visual value.- Parameters:
channel
- the encoding channel.value
- the constant visual value.- Returns:
- this object.
-
encodeDatum
Sets a constant data value encoded via a scale.- Parameters:
channel
- the encoding channel.datum
- the constant data value.- Returns:
- this object.
-
encodeDatum
Sets a constant data value encoded via a scale.- Parameters:
channel
- the encoding channel.datum
- the constant data value.- Returns:
- this object.
-
encodeDatum
Sets a constant data value encoded via a scale.- Parameters:
channel
- the encoding channel.datum
- the constant data value.- Returns:
- this object.
-
usermeta
Description copied from class:VegaLite
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
Description copied from class:VegaLite
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
Description copied from class:VegaLite
Sets the background of the entire view with CSS color property.- Overrides:
background
in classVegaLite
-
padding
Description copied from class:VegaLite
Specifies padding for all sides. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle. -
padding
Description copied from class:VegaLite
Specifies padding for each side. The visualization padding, in pixels, is from the edge of the visualization canvas to the data rectangle. -
autosize
Description copied from class:VegaLite
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
Description copied from class:VegaLite
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.- Overrides:
autosize
in classVegaLite
- 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
Description copied from class:VegaLite
Sets the name of the visualization for later reference. -
description
Description copied from class:VegaLite
Sets the description of this mark for commenting purpose.- Overrides:
description
in classVegaLite
-
title
Description copied from class:VegaLite
Sets a descriptive title to a chart.
-