[][src]Crate vega_lite_3

This crate provides a thin wrapper over Vega-Lite v3, as well as a few helpers to help ingest data from various sources and builders to help build graphs. See examples for more help on how to use it.

Documentation Disclaimer

Most of this crate has been generated from the json schema of Vega-Lite, so is the documentation on Vega-Lite types. A lot of struct are documented as accepting a string but are actually not. See FontWeight for an example. Those are usually converted to an enum, or may have a String variant wrapping the actual string (for example, Month). In those cases, From<String> is implemented for the enum, and will automatically wrap the string in the correct variant.

Structs

AggregatedFieldDef
AggregatedFieldDefBuilder

Builder for AggregatedFieldDef.

AreaConfig

Area-Specific Config

AreaConfigBuilder

Builder for AreaConfig.

ArgmDef
ArgmDefBuilder

Builder for ArgmDef.

AutoSizeParams
AutoSizeParamsBuilder

Builder for AutoSizeParams.

Axis
AxisBuilder

Builder for Axis.

AxisConfig

Axis configuration, which determines default properties for all x and y axes. For a full list of axis configuration options, please see the corresponding section of the axis documentation.

AxisConfigBuilder

Builder for AxisConfig.

AxisResolveMap
AxisResolveMapBuilder

Builder for AxisResolveMap.

BaseLegendLayout
BaseLegendLayoutBuilder

Builder for BaseLegendLayout.

BaseMarkConfig
BaseMarkConfigBuilder

Builder for BaseMarkConfig.

BaseTitleConfig

Title configuration, which determines default properties for all titles. For a full list of title configuration options, please see the corresponding section of the title documentation.

BaseTitleConfigBuilder

Builder for BaseTitleConfig.

BinParams

Binning properties or boolean flag for determining whether to bin data or not.

BinParamsBuilder

Builder for BinParams.

Binding
BindingBuilder

Builder for Binding.

BoxPlotConfig

Box Config

BoxPlotConfigBuilder

Builder for BoxPlotConfig.

BrushConfig

An interval selection also adds a rectangle mark to depict the extents of the interval. The mark property can be used to customize the appearance of the mark.

BrushConfigBuilder

Builder for BrushConfig.

CompositionConfig

Default configuration for all concatenation view composition operators (concat, hconcat, and vconcat)

CompositionConfigBuilder

Builder for CompositionConfig.

Conditional
ConditionalBuilder

Builder for Conditional.

ConditionalNumberValueDef
ConditionalNumberValueDefBuilder

Builder for ConditionalNumberValueDef.

ConditionalPredicateNumberValueDefClass
ConditionalPredicateNumberValueDefClassBuilder

Builder for ConditionalPredicateNumberValueDefClass.

ConditionalPredicateStringValueDefClass
ConditionalPredicateStringValueDefClassBuilder

Builder for ConditionalPredicateStringValueDefClass.

ConditionalPredicateValueDefClass
ConditionalPredicateValueDefClassBuilder

Builder for ConditionalPredicateValueDefClass.

ConditionalStringValueDef
ConditionalStringValueDefBuilder

Builder for ConditionalStringValueDef.

ConditionalValueDef
ConditionalValueDefBuilder

Builder for ConditionalValueDef.

Config

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

ConfigBuilder

Builder for Config.

Data

Secondary data source to lookup in.

DataBuilder

Builder for Data.

DataFormat

An object that specifies the format for parsing the data.

DataFormatBuilder

Builder for DataFormat.

DateTime

Object for defining datetime in Vega-Lite Filter. If both month and quarter are provided, month has higher precedence. day cannot be combined with other date. We accept string for month and day names.

DateTimeBuilder

Builder for DateTime.

DefWithConditionMarkPropFieldDefNumber

Fill opacity of the marks.

DefWithConditionMarkPropFieldDefNumberBuilder

Builder for DefWithConditionMarkPropFieldDefNumber.

DefWithConditionMarkPropFieldDefStringNull

Color of the marks – either fill or stroke color based on the filled property of mark definition. By default, color represents fill color for "area", "bar", "tick", "text", "trail", "circle", and "square" / stroke color for "line" and "point".

DefWithConditionMarkPropFieldDefStringNullBuilder

Builder for DefWithConditionMarkPropFieldDefStringNull.

DefWithConditionMarkPropFieldDefTypeForShapeStringNull

Shape of the mark.

DefWithConditionMarkPropFieldDefTypeForShapeStringNullBuilder

Builder for DefWithConditionMarkPropFieldDefTypeForShapeStringNull.

DefWithConditionTextFieldDefValue

A FieldDef with Condition { condition: {value: ...}, field: ..., ... }

DefWithConditionTextFieldDefValueBuilder

Builder for DefWithConditionTextFieldDefValue.

DomainClass
DomainClassBuilder

Builder for DomainClass.

Encoding

A key-value mapping between encoding channels and definition of fields.

EncodingBuilder

Builder for Encoding.

EncodingSortField

A sort definition for sorting a discrete scale in an encoding field definition.

EncodingSortFieldBuilder

Builder for EncodingSortField.

ErrorBandConfig

ErrorBand Config

ErrorBandConfigBuilder

Builder for ErrorBandConfig.

ErrorBarConfig

ErrorBar Config

ErrorBarConfigBuilder

Builder for ErrorBarConfig.

Facet

Definition for how to facet the data. One of:

FacetBuilder

Builder for Facet.

FacetFieldDef

A field definition for the horizontal facet of trellis plots.

FacetFieldDefBuilder

Builder for FacetFieldDef.

GraticuleParams
GraticuleParamsBuilder

Builder for GraticuleParams.

Header

An object defining properties of a facet's header.

HeaderBuilder

Builder for Header.

HeaderConfig

Header configuration, which determines default properties for all headers.

HeaderConfigBuilder

Builder for HeaderConfig.

HrefClass

A URL to load upon mouse click.

HrefClassBuilder

Builder for HrefClass.

ImputeParams

An object defining the properties of the Impute Operation to be applied. The field value of the other positional channel is taken as key of the Impute Operation. The field of the color channel if specified is used as groupby of the Impute Operation.

ImputeParamsBuilder

Builder for ImputeParams.

ImputeSequence
ImputeSequenceBuilder

Builder for ImputeSequence.

IntervalSelectionConfig

The default definition for an interval selection. All properties and transformations for an interval selection definition (except type) may be specified here.

IntervalSelectionConfigBuilder

Builder for IntervalSelectionConfig.

JoinAggregateFieldDef
JoinAggregateFieldDefBuilder

Builder for JoinAggregateFieldDef.

Latitude2Class

Latitude-2 position for geographically projected ranged "area", "bar", "rect", and "rule".

Latitude2ClassBuilder

Builder for Latitude2Class.

LatitudeClass

Latitude position of geographically projected marks.

LatitudeClassBuilder

Builder for LatitudeClass.

LayerEncoding

A shared key-value mapping between encoding channels and definition of fields in the underlying layers.

LayerEncodingBuilder

Builder for LayerEncoding.

LayerSpec

A full layered plot specification, which may contains encoding and projection properties that will be applied to underlying unit (single-view) specifications.

LayerSpecBuilder

Builder for LayerSpec.

Legend

Properties of a legend or boolean flag for determining whether to show it.

LegendBuilder

Builder for Legend.

LegendConfig

Legend configuration, which determines default properties for all legends. For a full list of legend configuration options, please see the corresponding section of in the legend documentation.

LegendConfigBuilder

Builder for LegendConfig.

LegendLayout

Legend orient group layout parameters.

LegendLayoutBuilder

Builder for LegendLayout.

LegendResolveMap
LegendResolveMapBuilder

Builder for LegendResolveMap.

LineConfig

Line-Specific Config

LineConfigBuilder

Builder for LineConfig.

LookupData

Secondary data reference.

LookupDataBuilder

Builder for LookupData.

MarkConfig

Circle-Specific Config

MarkConfigBuilder

Builder for MarkConfig.

MarkDefClass
MarkDefClassBuilder

Builder for MarkDefClass.

MultiSelectionConfig

The default definition for a multi selection. All properties and transformations for a multi selection definition (except type) may be specified here.

MultiSelectionConfigBuilder

Builder for MultiSelectionConfig.

NiceClass
NiceClassBuilder

Builder for NiceClass.

OrderFieldDef
OrderFieldDefBuilder

Builder for OrderFieldDef.

OrderFieldDefClass

Definition object for a constant value of an encoding channel.

OrderFieldDefClassBuilder

Builder for OrderFieldDefClass.

OverlayMarkDef
OverlayMarkDefBuilder

Builder for OverlayMarkDef.

PaddingClass
PaddingClassBuilder

Builder for PaddingClass.

Predicate
PredicateBuilder

Builder for Predicate.

Projection

Projection configuration, which determines default properties for all projections. For a full list of projection configuration options, please see the corresponding section of the projection documentation.

ProjectionBuilder

Builder for Projection.

RectConfig

Bar-Specific Config

RectConfigBuilder

Builder for RectConfig.

RepeatMapping
RepeatMappingBuilder

Builder for RepeatMapping.

RepeatRef

A ValueDef with optional Condition<ValueDef | FieldDef> { condition: {field: ...} | {value: ...}, value: ..., } Reference to a repeated value.

RepeatRefBuilder

Builder for RepeatRef.

Resolve

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

ResolveBuilder

Builder for Resolve.

RowColBoolean
RowColBooleanBuilder

Builder for RowColBoolean.

RowColLayoutAlign
RowColLayoutAlignBuilder

Builder for RowColLayoutAlign.

RowColNumber
RowColNumberBuilder

Builder for RowColNumber.

Scale
ScaleBuilder

Builder for Scale.

ScaleConfig

Scale configuration determines default properties for all scales. For a full list of scale configuration options, please see the corresponding section of the scale documentation.

ScaleConfigBuilder

Builder for ScaleConfig.

ScaleInterpolateParams
ScaleInterpolateParamsBuilder

Builder for ScaleInterpolateParams.

ScaleResolveMap
ScaleResolveMapBuilder

Builder for ScaleResolveMap.

SchemeConfig
SchemeConfigBuilder

Builder for SchemeConfig.

SchemeParams
SchemeParamsBuilder

Builder for SchemeParams.

Selection
SelectionBuilder

Builder for Selection.

SelectionConfig

An object hash for defining default properties for each type of selections.

SelectionConfigBuilder

Builder for SelectionConfig.

SelectionDef
SelectionDefBuilder

Builder for SelectionDef.

SequenceParams

Generate a sequence of numbers.

SequenceParamsBuilder

Builder for SequenceParams.

SignalRef
SignalRefBuilder

Builder for SignalRef.

SingleSelectionConfig

The default definition for a single selection. All properties and transformations for a single selection definition (except type) may be specified here.

SingleSelectionConfigBuilder

Builder for SingleSelectionConfig.

SortEncodingSortField

A sort definition for sorting a discrete scale in an encoding field definition.

SortEncodingSortFieldBuilder

Builder for SortEncodingSortField.

SortField

A sort definition for transform

SortFieldBuilder

Builder for SortField.

Spec

A specification of the view that gets repeated.

SpecBuilder

Builder for Spec.

SpecClass

A specification of the view that gets faceted.

SpecClassBuilder

Builder for SpecClass.

SphereClass
SphereClassBuilder

Builder for SphereClass.

TextConfig

Text-Specific Config

TextConfigBuilder

Builder for TextConfig.

TextFieldDef
TextFieldDefBuilder

Builder for TextFieldDef.

TickConfig

Tick-Specific Config

TickConfigBuilder

Builder for TickConfig.

TitleParams
TitleParamsBuilder

Builder for TitleParams.

TooltipContent
TooltipContentBuilder

Builder for TooltipContent.

Transform
TransformBuilder

Builder for Transform.

TypedFieldDef

Field Def without scale (and without bin: "binned" support).

TypedFieldDefBuilder

Builder for TypedFieldDef.

UrlData
UrlDataBuilder

Builder for UrlData.

Vegalite

A Vega-Lite top-level specification. This is the root class for all Vega-Lite specifications. (The json schema is generated from this type.)

VegaliteBuilder

Builder for Vegalite.

ViewBackground

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

ViewBackgroundBuilder

Builder for ViewBackground.

ViewConfig

Default properties for single view plots.

ViewConfigBuilder

Builder for ViewConfig.

WindowFieldDef
WindowFieldDefBuilder

Builder for WindowFieldDef.

X2Class

X2 coordinates for ranged "area", "bar", "rect", and "rule".

X2ClassBuilder

Builder for X2Class.

XClass

X coordinates of the marks, or width of horizontal "bar" and "area" without specified x2 or width.

XClassBuilder

Builder for XClass.

Y2Class

Y2 coordinates for ranged "area", "bar", "rect", and "rule".

Y2ClassBuilder

Builder for Y2Class.

YClass

Y coordinates of the marks, or height of vertical "bar" and "area" without specified y2 or height.

YClassBuilder

Builder for YClass.

Enums

Aggregate

Aggregation function for the field (e.g., mean, sum, median, min, max, count).

AggregateOp

An aggregate operation to perform on the field prior to sorting (e.g., "count", "mean" and "median"). An aggregation is required when there are multiple values of the sort field for each encoded data field. The input data objects will be aggregated, grouped by the encoded data field.

Align

The horizontal alignment of the text. One of "left", "right", "center".

AlignUnion

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

AnyMark

A string describing the mark type (one of "bar", "circle", "square", "tick", "line", "area", "point", "rule", "geoshape", and "text") or a mark definition object.

Autosize

Sets 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. "fit" is only supported for single and layered views that don't use rangeStep.

AutosizeType

The sizing format type. One of "pad", "fit" or "none". See the autosize type documentation for descriptions of each.

BinEnum
BindEnum

Establishes a two-way binding between the interval selection and the scales used within the same view. This allows a user to interactively pan and zoom the view.

BindValue
BottomCenter
BoundsEnum

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

BoxPlotDefExtent
BoxplotExtent

The extent of the whiskers. Available options include:

ColorCondition
ConditionUnion
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.

Content
Cursor

The mouse cursor used over the mark. Any valid CSS cursor type can be used.

DataFormatType

Type of input data: "json", "csv", "tsv", "dsv".

Day

Value representing the day of a week. This can be one of: (1) integer value -- 1 represents Monday; (2) case-insensitive day name (e.g., "Monday"); (3) case-insensitive, 3-character short day name (e.g., "Mon").
Warning: A DateTime definition object with day** should not be combined with year, quarter, month, or date.

DefBox
Detail
Dir

The direction of the text. One of "ltr" (left-to-right) or "rtl" (right-to-left). This property determines on which side is truncated in response to the limit parameter.

Direction

The layout direction for legend orient group layout.

Domain
DomainUnion

Customized domain values.

Empty

By default, all data values are considered to lie within an empty selection. When set to none, empty selections contain no data values.

EqualUnion
ErrorbandExtent

The extent of the band. Available options include:

ExtentEnum
ExtentExtent

The extent of the band. Available options include:

Field

Required. A string defining the name of the field from which to pull a data value or an object defining iterated values from the repeat operator.

FieldTitle

Defines how Vega-Lite generates title for fields. There are three possible styles:

FillOpacityCondition
FluffyBin
FontWeight

The font weight. This can be either a string (e.g "bold", "normal") or a number (100, 200, 300, ..., 900 where "normal" = 400 and "bold" = 700).

FontWeightEnum
FormatType

The format type for labels ("number" or "time").

Graticule

Generate graticule GeoJSON data for geographic reference lines.

HrefCondition
ImputeMethod

The imputation method to use for the field value of imputed data objects. One of value, mean, median, max or min.

InitSelectionInitMapping
InlineDatasetValue

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.

Interpolate

The line interpolation method to use for line and area marks. One of the following:

InterpolateUnion

The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include rgb, hsl, hsl-long, lab, hcl, hcl-long, cubehelix and cubehelix-long ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued type property and an optional numeric gamma property applicable to rgb and cubehelix interpolators. For more, see the d3-interpolate documentation.

InvalidValues
Keyvals
Label

Indicates if labels should be hidden if they exceed the axis range. If false (the default) no bounds overlap analysis is performed. If true, labels will be hidden if they exceed the axis range by more than 1 pixel. If this property is a number, it specifies the pixel tolerance: the maximum amount by which a label bounding box may exceed the axis range.

LabelOverlap

The strategy to use for resolving overlap of axis labels. If false (the default), no overlap reduction is attempted. If set to true or "parity", a strategy of removing every other label is used (this works well for standard linear axes). If set to "greedy", a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).

LabelOverlapEnum
LatitudeType

The encoded field's type of measurement ("quantitative", "temporal", "ordinal", or "nominal"). It can also be a "geojson" type for encoding 'geoshape'.

LayoutAlign

The alignment to apply to symbol legends rows and columns. The supported string values are "all", "each" (the default), and none. For more information, see the grid layout documentation.

LayoutBounds

The bounds calculation to use for legend orient group layout.

LegendOrient

The orientation of the legend, which determines how the legend is positioned within the scene. One of "left", "right", "top-left", "top-right", "bottom-left", "bottom-right", "none".

LegendType

The type of the legend. Use "symbol" to create a discrete legend and "gradient" for a continuous color gradient.

Line
LogicalOperandPredicateElement

Predicate for triggering the condition

Lt
Margin
Mark

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").

Month

One of: (1) integer value representing the month from 1-12. 1 represents January; (2) case-insensitive month name (e.g., "January"); (3) case-insensitive, 3-character short month name (e.g., "Jan").

MultiInit
NiceTime
NiceUnion

Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.201479…, 0.996679…], a nice domain might be [0.2, 1.0].

Op

The window or aggregation operation to apply within a window (e.g.,rank, lead, sum, average or count). See the list of all supported operations here.

Order
Orient

The orientation of the header label. One of "top", "bottom", "left" or "right".

Orientation

The orientation of a non-stacked bar, tick, area, and line charts. The value is either horizontal (default) or vertical.

Padding

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.

PointEnum
PointUnion
ProjectionType

The cartographic projection to use. This value is case-insensitive, for example "albers" and "Albers" indicate the same projection type. You can find all valid projection types in the documentation.

PurpleBin

An object indicating bin properties, or simply true for using default bin parameters.

PurpleLogicalOperandPredicate

Predicate for triggering the condition

PurpleSelectionOperand

Filter using a selection name.

RangeElement
RangeRange
RangeValue
RemovableValue

Wrapper for a field that can be either the default value, null or specified

RepeatEnum
RepeatUnion

Definition for fields to be repeated. One of:

ResolveMode
ScaleInterpolate
ScaleInterpolateParamsType
ScaleRange

The range of the scale. One of:

ScaleType

The type of scale. Vega-Lite supports the following categories of scale types:

Scheme

A string indicating a color scheme name (e.g., "category10" or "blues") or a scheme parameter object.

SelectionDefBind
SelectionDefInit
SelectionDefType

Determines the default event processing and data query for the selection. Vega-Lite currently supports three selection types:

SelectionInitIntervalElement
SelectionOperandElement

Filter using a selection name.

SelectionResolution

With layered and multi-view displays, a strategy that determines how selections' data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain.

SingleDefUnitChannel

The encoding channel to sort by (e.g., "x", "y")

Sort

Sort order for the encoded field.

SortArray

Sort order for the encoded field.

SortOrder

The sort order. One of "ascending" (default) or "descending".

Spacing
SphereUnion

Generate sphere GeoJSON data for the full globe.

Stack

Type of stacking offset if the field should be stacked. stack is only applicable for x and y channels with continuous domains. For example, stack of y can be used to customize stacking for a vertical bar chart.

StackOffset

Default stack offset for stackable mark.

StandardType

The encoded field's type of measurement ("quantitative", "temporal", "ordinal", or "nominal"). It can also be a "geojson" type for encoding 'geoshape'.

StrokeCap

The stroke cap for line ending style. One of "butt", "round", or "square".

StrokeJoin

The stroke line join method. One of "miter", "round" or "bevel".

Style

A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the style configuration. If style is an array, later styles will override earlier styles. Any mark properties explicitly defined within the encoding will override a style default.

TextBaseline

The vertical alignment of the text. One of "top", "middle", "bottom".

TimeUnit

Time unit for the field to be filtered.

Title
TitleAnchor
TitleFrame

The reference frame for the anchor position, one of "bounds" (to anchor relative to the full bounding box) or "group" (to anchor relative to the group width or height).

TitleOrient

Default title orientation ("top", "bottom", "left", or "right")

Tooltip
TooltipUnion
Translate

When truthy, allows a user to interactively move an interval selection back-and-forth. Can be true, false (to disable panning), or a Vega event stream definition which must include a start and end event to trigger continuous panning.

TypeForShape

The encoded field's type of measurement ("quantitative", "temporal", "ordinal", or "nominal"). It can also be a "geojson" type for encoding 'geoshape'.

UrlDataInlineDataset

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.

Value

A constant value in visual domain (e.g., "red" / "#0099ff" for color, values between 0 to 1 for opacity).

VegaliteCenter
XEnum
XUnion
YEnum
YUnion

Traits

Showable

Functions

iter_to_data

Helper method turning an iterator over a Serialize-able type into a data that can't be used in a graph.