This module allows you to create Vega-Lite specifications in Elm. A specification
is stored as a JSON object which can be sent to a Vega-Lite compiler to generate
the graphics. While this a 'pure' Elm library, to create the graphical output you
probably want to send a Vega-Lite specification generated by toVegaLite via a
port to some JavaScript that invokes the Vega-Lite runtime.
Top-level Vega-Lite properties. These are the ones that define the core of the
visualization grammar. All VLProperties are created by functions which can be
arranged into seven broad groups.
Data Properties relate to the input data to be visualized. Generated by
dataFromColumns, dataFromRows,
dataFromUrl, dataFromSource and
dataFromJson.
Transform Properties indicate that some transformation of input data should
be applied before encoding them visually. Generated by transform
and projection they can include data transformations such as filter,
binAs and calculateAs and geo transformations of longitude, latitude coordinates
used by marks such as those generated by geoshape, point and line.
Mark Functions relate to the symbols used to visualize data items. Generated
by functions such as circle, bar and line.
Encoding Properties specify which data elements are mapped to which mark characteristics
(known as channels). Generated by encoding they include encodings
such as position, color, size, shape text and hyperlink.
Composition Properties allow visualization views to be combined to form more
complex visualizations. Generated by layer, repeat,
facet, hConcat, vConcat, spec
and resolve.
Interaction Properties allow interactions such as clicking, dragging and others
generated via a GUI or data stream to influence the visualization. Generated by
selection.
Supplementary and Configuration Properties provide a means to add metadata and
styling to one or more visualizations. Generated by name, title,
description, background, width,
height, padding, autosize and
configure.
Represents part or all of Vega-Lite specification. Specs can be (and usually are) nested. They can range from a single Boolean value up to the entire Vega-Lite specification.
Represents a named Vega-Lite specification, usually generated by an elm-vega
function. You shouldn't need to create LabelledSpec tuples directly, but they
can be useful for type annotations.
Combines a list of labelled specifications into a single specification that may be passed to JavaScript for rendering. This is useful when you wish to create a single page with multiple visulizualizations.
combineSpecs
[ ( "vis1", myFirstVis )
, ( "vis2", mySecondVis )
, ( "vis3", myOtherVis )
]Functions and types for declaring the input data to the visualization.
Declare data source from a url. The URL can be a local path on a web server or an external http(s) URL. Used to create a data ( property, specification ) pair. An optional list of field formatting instructions can be provided as the second parameter or an empty list to use the default formatting. See the Vega-Lite documentation for details.
enc = ...
toVegaLite
[ dataFromUrl "data/weather.csv" [ parse [ ( "date", foDate "%Y-%m-%d %H:%M" ) ] ]
, line []
, enc []
]Declare a data source from a provided list of column values. Each column contains
values of the same type, but columns each with a different type are permitted.
Columns should all contain the same number of items; if not the dataset will be
truncated to the length of the shortest column. An optional list of field formatting
instructions can be provided as the first parameter or an empty list to use the
default formatting. See the
Vega-Lite documentation
for details.
The columns themselves are most easily generated with dataColumn
data =
dataFromColumns [ parse [ ( "Year", foDate "%Y" ) ] ]
<< dataColumn "Animal" (strs [ "Fish", "Dog", "Cat" ])
<< dataColumn "Age" (nums [ 28, 12, 6 ])
<< dataColumn "Year" (strs [ "2010", "2014", "2015" ])Declare a data source from a provided list of row values. Each row contains
a list of tuples where the first value is a string representing the column name, and the
second the column value for that row. Each column can have a value of a different type
but you must ensure that when subsequent rows are added, they match the types of previous
values with shared column names. An optional list of field formatting instructions can
be provided as the first parameter or an empty list to use the default formatting. See the
Vega-Lite documentation
for details.
The rows themselves are most easily generated with dataRow. Note though that generally
if you are creating data inline (as opposed to reading from a file), adding data by column
is more efficient and less error-prone.
data =
dataFromRows [ parse [ ( "Year", foDate "%Y" ) ] ]
<< dataRow [ ( "Animal", str "Fish" ), ( "Age", num 28 ), ( "Year", str "2010" ) ]
<< dataRow [ ( "Animal", str "Dog" ), ( "Age", num 12 ), ( "Year", str "2014" ) ]
<< dataRow [ ( "Animal", str "Cat" ), ( "Age", num 6 ), ( "Year", str "2015" ) ]Declare a data source from a provided json specification. The most likely use-case
for specifying json inline is when creating geojson objects,
when geometry, geometryCollection and
geoFeatureCollection functions may be used. For more
general cases of json creation, consider
Json.Encode.
let
geojson =
geometry (geoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
in
toVegaLite
[ width 200
, height 200
, dataFromJson geojson []
, projection [ prType Orthographic ]
, geoshape []
]Declare data from a named source. The source may be from named datasets within
a specification or a named data source created via the
Vega View API.
An optional list of field formatting instructions can be provided as the second
parameter or an empty list to use the default formatting. See the
Vega-Lite documentation
for details.
data = ...
json = ...
enc = ...
toVegaLite
[ datasets [ ( "myData", data [] ), ( "myJson", dataFromJson json [] ) ]
, dataFromSource "myData" []
, bar []
, enc []
]Create a dataset comprising a collection of named Data items. Each data item
can be created with normal data generating functions such as dataFromRows or
dataFromJson. These can be later referred to using dataFromSource.
import Json.Encode as JE
let
data =
dataFromRows []
<< dataRow [ ( "cat", str "a" ), ( "val", num 10 ) ]
<< dataRow [ ( "cat", str "b" ), ( "val", num 18 ) ]
json =
JE.list
[ JE.object [ ( "cat", JE.string "a" ), ( "val", JE.float 120 ) ]
, JE.object [ ( "cat", JE.string "b" ), ( "val", JE.float 180 ) ]
]
enc = ...
in
toVegaLite
[ datasets [ ( "myData", data [] ), ( "myJson", dataFromJson json [] ) ]
, dataFromSource "myData" []
, bar []
, enc []
]Create a column of data. A column has a name and a list of values. The final parameter is the list of any other columns to which this is added.
dataColumn "Animal" (strs [ "Cat", "Dog", "Mouse"]) []Create a row of data. A row comprises a list of (columnName,value) pairs. The final parameter is the list of any other rows to which this is added.
dataRow [ ("Animal", str "Fish"), ("Age", num 28), ("Year", str "2010") ] []Convenience type annotation label for use with data generation functions.
myRegion : List DataColumn -> Data
myRegion =
dataFromColumns []
<< dataColumn "easting" (nums [ -3, 4, 4, -3, -3 ])
<< dataColumn "northing" (nums [ 52, 52, 45, 45, 52 ])Represents a single column of data. Used when generating inline data with
dataColumn.
Represents a single row of data. Used when generating inline data with
dataRow.
Specifies a geometric object to be used in a geoshape specification. The
first parameter is the geometric type, the second an optional list of properties
to be associated with the object.
geojson =
geometry (geoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []Specifies a list of geo features to be used in a geoshape specification.
Each feature object in this collection can be created with the geometry function.
geojson =
geoFeatureCollection
[ geometry (geoPolygon [ [ ( -3, 59 ), ( -3, 52 ), ( 4, 52 ), ( -3, 59 ) ] ])
[ ( "myRegionName", str "Northern region" ) ]
, geometry (geoPolygon [ [ ( -3, 52 ), ( 4, 52 ), ( 4, 45 ), ( -3, 52 ) ] ])
[ ( "myRegionName", str "Southern region" ) ]
]Specifies a list of geometry objects to be used in a geoshape specification.
Each geometry object in this collection can be created with the geometry function.
geojson =
geometryCollection
[ geometry (geoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
, geometry (geoPoint -3.5 55.5) []
]Specify point geometry for programmatically creating GeoShapes. This is equivalent
to the GeoJson geometry point type
in the GeoJSON specification.
Specify multi-point geometry for programmatically creating GeoShapes. This is equivalent
to the GeoJson geometry multi-point type
in the GeoJSON specification.
Specify line geometry for programmatically creating GeoShapes. This is equivalent
to the GeoJson geometry line type
in the GeoJSON specification.
Specify multi-line geometry for programmatically creating GeoShapes. This is equivalent
to the GeoJson geometry multi-line type
in the GeoJSON specification.
Specify polygon geometry for programmatically creating GeoShapes. This is equivalent
to the GeoJson geometry polygon type
in the GeoJSON specification.
Specify multi-polygon geometry for programmatically creating GeoShapes. This is equivalent
to the GeoJson geometry multi-polygon type
in the GeoJSON specification.
Indicates the type of data to be parsed when reading input data. When parsing
dates, you should use the foDate or foUtc functions rather than their
equivalent (deprecated) type constructors.
Specifies the type of format a data source uses. If the format is indicated by
the file name extension (.tsv, .csv, .json) there is no need to indicate the
format explicitly. However this can be useful if the filename extension does not
indicate type (e.g. .txt). To customise the parsing of a file use one of the
functions parse, jsonProperty, topojsonFeature or topojsonMesh in preference
to their (depcrecated) type constructor equivalents. For details see the
Vega-Lite documentation.
Indicates a JSON file format from which a given property is to be extracted
when it has some surrounding structure or meta-data. For example, specifying
the property values.features is equivalent to retrieving json.values.features
from the loaded JSON object with a custom delimeter. For details, see the
Vega-Lite JSON documentation.
Indicates a topoJSON feature format. The first parameter should be the name of the object set to extract. Typically used when specifying a data url.
Indicates a topoJSON mesh format. The first parameter should be the name
of the object set to extract. Unlike the topojsonFeature, the corresponding
geo data are returned as a single, unified mesh instance, not as individual
GeoJSON features. Typically used when specifying a data url.
Indicates the parsing rules when processing some data text. The parameter is a list of tuples where each corresponds to a field name paired with its desired data type. Typically used when specifying a data url.
Specity a date format for parsing input data. Formatting can be specified using D3's formatting specifiers or left as an empty string if default date formatting is to be applied. Care should be taken when assuming default parsing of dates because different browsers can parse dates differently. Being explicit about the date format is usually safer.
Specity a UTC date format for parsing input data. Formatting can be specified using D3's formatting specifiers or left as an empty string if default date formatting is to be applied. Care should be taken when assuming default parsing of UTC dates because different browsers can parse dates differently. Being explicit about the date format is usually safer.
Functions and types for declaring the transformation rules that are applied to data fields or geospatial coordinates before they are encoded visually.
Create a single transform from a list of transformation specifications. Note
that the order of transformations can be important, especially if labels created
with calculateAs, timeUnitAs and binAs are used in other transformations.
Using the functional composition pipeline idiom (as example below) allows you to
provide the transformations in the order intended in a clear manner.
trans =
transform
<< filter (fiExpr "datum.year == 2010")
<< calculateAs "datum.sex == 2 ? 'Female' : 'Male'" "gender"Sets the cartographic projection used for geospatial coordinates. A projection
defines the mapping from (longitude,latitude) to an (x,y) plane used for rendering.
This is useful when using the Geoshape mark. For further details see the
Vega-Lite documentation.
proj =
projection [ prType Orthographic, prRotate -40 0 0 ]Specify the type of global map projection to use in a projection transformation. For details see the Vega-Lite projection documentation
Specify a projection’s clipping circle radius to the specified angle in degrees.
A value of Nothing will switch to antimeridian cutting rather than small-circle
clipping. For details see the
Vega-Lite projection documentation
Specify a projection’s viewport clip extent to the specified bounds in pixels. For details see the Vega-Lite projection documentation
Specify a projection’s center as longitude and latitude in degrees. The default
value is 0,0. For details see the
Vega-Lite projection documentation
Specify a projection’s three-axis rotation angle. This should be in order lambda phi gamma specifying the rotation angles in degrees about each spherical axis (corresponding to yaw, pitch and roll.). For details see the Vega-Lite projection documentation
Specify a threshold for the projection’s adaptive resampling in pixels. This corresponds to the Douglas–Peucker distance. If precision is not specified, the projection’s current resampling precision which defaults to √0.5 ≅ 0.70710 is used. For details see the Vega-Lite projection documentation
Specify a 'Hammer' map projection coefficient. For details see the Vega-Lite projection documentation
Specify a 'Satellite' map projection distance. For details see the Vega-Lite projection documentation
Specify a Bottomley map projection fraction. For details see the
Vega-Lite projection documentation
Specify the number of lobes in lobed map projections such as the 'Berghaus star'. For details see the Vega-Lite projection documentation
Specify a parallel for map projections such as the 'Armadillo'. For details see the Vega-Lite projection documentation
Specify a radius value for map projections such as the 'Gingery'. For details see the Vega-Lite projection documentation
Specify a ratio value for map projections such as the 'Hill'. For details see the Vega-Lite projection documentation
Specify a spacing value for map projections such as the 'Lagrange'. For details see the Vega-Lite projection documentation
Specify a 'Satellite' map projection tilt. For details see the Vega-Lite projection documentation
Types of geographic map projection. These are based on a subset of those provided by the d3-geo library. For details of available projections see the Vega-Lite documentation.
Note: The use of the Custom type constructor is deprecated in favour of the
customProjection function.
Specify a custom projection type. Additional custom projections from d3 can
be defined via the Vega API
and called from with this function where the parameter is the name of the D3
projection to use (e.g. customProjection "winkel3").
Specifies whether or not a clipping rectangle is to be applied. If it is, the
function clipRect should be called rather than the (deprecated) type constructor
LTRB.
Specify a clipping rectangle in pixel units. The four parameters are respectively 'left', 'top', 'right' and 'bottom' of the rectangular clipping bounds.
Defines a set of named aggregation transformations to be used when encoding channels. This is useful when, for example, you wish to apply the same transformation to a number of channels but do not want to define it each time. The first parameter is a list of the named aggregation operations to apply. The second parameter is a list of 'group by' fields. The third parameter is the list of transformations to which this is to be added. For further details see the Vega-Lite documentation.
trans =
transform
<< aggregate
[ opAs Min "people" "lowerBound", opAs Max "people" "upperBound" ]
[ "age" ]Type of aggregation operation. See the Vega-Lite documentation for more details.
Create a named aggregation operation on a field that can be added to a transformation. The first parameter is the aggregation operation to use; the second the name of the field in which to apply it and the third the name to be given to this transformation. For further details see the Vega-Lite documentation.
trans =
transform
<< aggregate
[ opAs Min "people" "lowerBound"
, opAs Max "people" "upperBound"
]
[ "age" ]Creates a new data field based on the given temporal binning. Unlike the direct encoding binning, this transformation is named and so can be referred to in multiple encodings. The first parameter is the 'width' of each temporal bin, the second is the field to bin and the third is name to give the newly binned field. The final, often implicit, parameter is a list of previous transformations to which this is added. Note though that usually it is easer to apply the temporal binning directly as part of the encoding as this will automatically format the temporal axis. See the Vega-Lite documentation for further details.
The following example takes a temporal dataset and encodes daily totals from it grouping by month.
trans =
transform << timeUnitAs Month "date" "monthly"
enc =
encoding
<< position X [ pName "date", pMType Temporal, pTimeUnit Day ]
<< position Y [ pAggregate Sum, pMType Quantitative ]
<< detail [ dName "monthly", dMType Temporal ]Create a named binning transformation that may be referenced in other Transformations
or encodings. The type of binning can be customised with a list of BinProperty
generating functions (biBase, biDivide etc.) or an empty list to use the default
binning. For more details, see the
Vega-Lite documentation.
trans =
transform
<< binAs [ MaxBins 3 ] "IMDB_Rating" "ratingGroup"Note that usually, direct binning within an encoding is preferred over this form of bin transformation.
Specify the number base to use for automatic bin determination (default is base 10). For more details, see the Vega-Lite binning documentation
Specify the scale factors indicating allowable subdivisions for binning. The default value is [5, 2], which indicates that for base 10 numbers (the default base), binning will consider dividing bin sizes by 5 and/or 2. For more details, see the Vega-Lite binning documentation
Specify the desired range of bin values when binning a collection of values. The first and second parameters indicate the minimum and maximum range values respectively. For more details, see the Vega-Lite binning documentation
Specify the maximum number of bins when binning a collection of values. For more details, see the Vega-Lite binning documentation
Specify the step size between bins when binning a collection of values. For more details, see the Vega-Lite binning documentation
Specify whether or not binning boundaries use human-friendly values such as multiples of ten. For more details, see the Vega-Lite binning documentation
Specify an exact step size between bins when binning a collection of values. For more details, see the Vega-Lite binning documentation
Specify the allowable step sizes between bins when binning a collection of values. For more details, see the Vega-Lite binning documentation
Creates a new data field based on calculations from existing fields. The first parameter is an expression representing the calculation and the second is the name to give the newly calculated field. This third parameter is a list of any previous calculations to which this is to be added. See the Vega-Lite documentation for further details.
trans =
transform << calculateAs "datum.sex == 2 ? 'F' : 'M'" "gender"Adds the given filter operation a list of transformations that may be applied to a channel or field. The first parameter is the filter operation and the second, often implicit, parameter is the list of other filter operations to which this should be added in sequence.
trans =
transform
<< filter (fiEqual "Animal" (str "Cat"))Filter operations can combine selections and data predicates with BooleanOp expressions:
trans =
transform
<< filter (fiCompose (and (expr "datum.Weight_in_lbs > 3000") (fiSelection "brush")))Filter a data stream so that only data in a given field equal to the given value are used. For details, see the Vega-Lite documentation.
Filter a data stream so that only data that satisfy the given predicate expression are used. For details, see the Vega-Lite documentation.
Build up a filtering predicate through logical composition (and, or etc.).
See the Vega-Lite documentation
for details.
Filter a data stream so that only data in a given field that are within the given interactive selection are used. For details, see the Vega-Lite documentation.
Filter a data stream so that only data in a given field contained in the given list of values are used. For details, see the Vega-Lite documentation.
Filter a data stream so that only data in a given field that are within the given range are used. For details, see the Vega-Lite documentation.
Specify the min max number range to be used in data filtering.
Specify the min max date-time range to be used in data filtering. If either parameter is an empty list, it is assumed to be unbounded.
Perform a lookup of named fields between two data sources. This allows you to
find values in one data source based on the values in another (like a relational
join). The first parameter is the field in the primary data source to act as key,
the second is the secondary data source which can be specified with a call to dataFromUrl
or other data generating function. The third is the name of the field in the secondary
data source to match values with the primary key. The fourth parameter is the list
of fields to be stored when the keys match. As with other transformation functions,
the final implicit parameter is a list of any other transformations to which this
is to be added.
Unlike lookupAs, this function will only return the specific fields named in the
fourth parameter. If you wish to return the entire set of fields in the secondary
data source as a single object, use lookupAs.
See the Vega-Lite documentation for further details.
The following would return the values in the age and height fields from
lookup_people.csv for all rows where the value in the name column in that
file matches the value of person in the primary data source.
data =
dataFromUrl "data/lookup_groups.csv" []
trans =
transform
<< lookup "person" (dataFromUrl "data/lookup_people.csv" []) "name" [ "age", "height" ]Perform an object lookup between two data sources. This allows you to find
values in one data source based on the values in another (like a relational
join). The first parameter is the field in the primary data source to act as key,
the second is the secondary data source which can be specified with a call to
dataFromUrl or other data generating function. The third is the name of the field
in the secondary data source to match values with the primary key. The fourth
parameter is the name to be given to the object storing matched values. As with
other transformation functions, the final implicit parameter is a list of any other
transformations to which this is to be added.
Unlike lookup, this function returns the entire set of field values from the
secondary data source when keys match. Those fields are stored as an object with
the name provided in the fourth parameter.
See the Vega-Lite documentation for further details.
In the following example, personDetails would reference all the field values in
lookup_people.csv for each row where the value in the name column in that
file matches the value of person in the primary data source.
data =
dataFromUrl "data/lookup_groups.csv" []
trans =
transform
<< lookupAs "person" (dataFromUrl "data/lookup_people.csv" []) "name" "personDetails"Adds the window transform to a list of transformations that may be applied to a data stream. The window transform performs calculations over sorted groups of data objects. These calculations including ranking, lead/lag analysis, and aggregates such as running sums and averages. Calculated values are written back to the input data stream.
The first parameter is the name to give the transformed output. The second is the window transform field definition. The third the window transform definition.
trans =
transform
<< windowAs "TotalTime"
[ wiAggregateOp Sum, wiField "Time" ]
[ wiFrame Nothing Nothing ]Specify an aggregrate operation as part of a window transformation.
A window transformation must specify either one of these aggregate operations or
a window-only transformation (wiOp). For details see the
Vega-Lite window transform documentation
Specify an window-specific operation as part of a window transformation.
A window transformation must specify either one of these window-only operations
or an aggregate transformation (wiAggregateOp). For details see the
Vega-Lite window transform documentation
Specify the numeric parameter for those window-only operations that can be
parameterised (Ntile, Lag, Lead and NthValue). For details see the
Vega-Lite window transform documentation
Specify an data field for which to compute an operation. This is not needed
for operations that do not apply to fields such as Count, Rank and DenseRank.
For details see the
Vega-Lite window transform documentation
Specify a sliding window should be produced for use by a window transform.
The two parameters should either be a Just a number indicating the offset from
the current data object, or Nothing to indicate unbounded rows preceding or
following the current data object. The default value is equivalent to Nothing (Just 0),
indicating that the sliding window includes the current object and all preceding
objects. The value (Just 5) (Just 5) indicates that the window should include
five objects preceding and five objects following the current object. Finally,
Nothing Nothing indicates that the window frame should always include all data
objects. For details see the
Vega-Lite window transform documentation
Specify whether or not the sliding window frame in a window transform should ignore peer values (those considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to be true, the window frame will be defined by offset values only. For details see the Vega-Lite window transform documentation
Specify the data fields for partioning data objects in a window transform into separate windows. If unspecified, all points will be in a single group. For details see the Vega-Lite window transform documentation
Specify a comparator for sorting data objects within a window transform. If
two data objects are considered equal by the comparator, they are considered peer
values of equal rank. If not specified, data objects are processed in the order
they are observed and none are considered peers. For details see the
Vega-Lite window transform documentation
Specify that the given field should be sorted in ascending order when performing a window transform. For details, see the Vega-Lite window transform field documentation
Specify that the given field should be sorted in descending order when performing a window transform. For details, see the Vega-Lite window transform field documentation
Window transform field definition. For details see the Vega-Lite window transform field documentation
Operations that may be applied during a window transformation. For details see the Vega-Lite window operation documentation.
Window transform properties for performing calculations over sorted groups. For details see the Vega-Lite window transform documentation
A named field with either an ascending or descending sort direction. Used by the window transform for performing calculations over sorted groups. For details, see the Vega-Lite window transform field documentation
Functions and types for declaring the type of visual marks used in the visualization.
The preferred method of specifying mark types is to call the relevant mark function
(e.g. bar, line etc.) rather than mark Bar, mark Line etc.
Specify an area mark. An area mark is used for representing a series of data elements, such as in a stacked area chart or streamgraph. For details see the Vega Lite documentation.
area [ maStroke "white" ]To keep the default style for the mark, just provide an empty list as the parameter.
area []Specify an bar mark. Bars are used for histograms, bar charts etc. for showing the magnitude of values in categories. For details see the Vega Lite documentation.
bar [ maFill "black", maStroke "white", maStrokeWeight 2 ]To keep the default style for the mark, just provide an empty list as the parameter.
bar []Specify a circle mark for symbolising points. For details see the Vega Lite documentation.
circle [ maStroke "red", maStrokeWeight 2 ]To keep the default style for the mark, just provide an empty list as the parameter.
circle []Specify a an arbitrary shape determined by georaphically referenced coordinates. For details see the Vega Lite documentation.
geoshape [ maFill "blue", maStroke "white" ]Specify a line mark for symbolising a sequence of values. For details see the Vega Lite documentation.
line [maStroke "red", maStrokeDash [1, 2] ]To keep the default style for the mark, just provide an empty list as the parameter.
line []Specify a point mark for symbolising a data point with a symbol. For details see the Vega Lite documentation.
point [ maFill "black", maStroke "red" ]To keep the default style for the mark, just provide an empty list as the parameter.
point []Specify an arbitrary rectangle. For details see the Vega Lite documentation.
rect [ maFill "black", maStroke "red" ]To keep the default style for the mark, just provide an empty list as the parameter.
rect []Specify a line seqment connecting two vertices. Can either be used to span the entire width or height of a view, or to connect two arbitrary positions. For details see the Vega Lite documentation.
rule [ maStroke "red" ]To keep the default style for the mark, just provide an empty list as the parameter.
rule []Specify a square mark for symbolising points. For details see the Vega Lite documentation.
square [ maStroke "red", maStrokeWeight 2 ]To keep the default style for the mark, just provide an empty list as the parameter.
square []Specify a text mark to be displayed at some point location. For details see the Vega Lite documentation.
textMark [ maFontSize 18 ]To keep the default style for the mark, just provide an empty list as the parameter.
textMark []Specify a short line mark for symbolising point locations. For details see the Vega Lite documentation.
tick [ maStroke "blue", maStrokeWeight 0.5 ]To keep the default style for the mark, just provide an empty list as the parameter.
tick []Specify a trail mark. A trail is a line that can vary in thickness along its length. For details see the Vega Lite documentation.
trail [ maInterpolate StepAfter ]Specify the horizontal alignment of a text mark. For details see the Vega-Lite text mark property documentation
Specify the rotation angle in degrees of a text mark. For details see the Vega-Lite text mark property documentation
Specify the band size in pixels of a bar mark. For details see the Vega-Lite bar mark property documentation
Specify the vertical alignment of a text mark. For details see the Vega-Lite text mark property documentation
Specify the offset between bars for a binned field using a bar mark. For details see the Vega-Lite bar mark property documentation
Specify whether or not a makr should be clipped to the enclosing group's dimensions. For details see the Vega-Lite mark property documentation
Specify the default color of a mark. Note that maFill and maStroke have
higher precedence and will override this if specified. For details see the
Vega-Lite mark property documentation
Specify the cursor to be associated with a hyperlink mark. For details see the Vega-Lite mark property documentation
Specify the continuous band size in pixels of a bar mark. For details see the Vega-Lite bar mark property documentation
Specify the discrete band size in pixels of a bar mark. For details see the Vega-Lite bar mark property documentation
Specify the horizontal offset in pixels between a text mark and its anchor. For details see the Vega-Lite text mark property documentation
Specify the vertical offset in pixels between a text mark and its anchor. For details see the Vega-Lite text mark property documentation
Specify the default fill color of a mark. For details see the Vega-Lite mark property documentation
Specify whether or not a mark's color should be used as the fill color instead of stroke color. For details see the Vega-Lite mark property documentation
Specify the For details see the Vega-Lite mark property documentation
Specify the font of a text mark. This can be any font name made accessible via
a css file (or one of the generic fonts serif, monospace etc.). For details see the
Vega-Lite text mark property documentation
Specify the font size in pixels used by a text mark. For details see the Vega-Lite text mark property documentation
Specify the font style (e.g. italic) used by a text mark. For details see the
Vega-Lite text mark property documentation
Specify the font wight used by a text mark. For details see the Vega-Lite text mark property documentation
Specify the interpolation method used by line and area marks. For details see the Vega-Lite line mark property documentation
Specify the overal opacity of a mark in the range [0, 1]. For details see the Vega-Lite mark property documentation
Specify the orientation of a non-stacked bar, tick, area or line mark. For details see the Vega-Lite line mark property documentation
Specify the appearance of a point marker placed on the vertices of a line or area mark. For details see the Vega-Lite line mark property documentation
Specify the polar coordinate radial offset of a text mark from its origin. For details see the Vega-Lite text mark property documentation
Specify the shape of a point mark. For details see the Vega-Lite point mark property documentation
Specify whether or not month and weekday names are abbreviated in a text mark. For details see the Vega-Lite text mark property documentation
Specify the size of a mark. For details see, for example, the Vega-Lite circle mark property documentation
Specify the default stroke color of a mark. For details see the Vega-Lite mark property documentation
Specify the stroke dash style used by a mark. A stroke dash style is determined by an alternating 'on-off' sequence of line lengths in pixel units. For details see the Vega-Lite mark property documentation
Specify the stroke dash offset used by a mark. This is the number of pixels before which the first line dash is drawn. For details see the Vega-Lite mark property documentation
Specify the stroke opacity of a mark in the range [0, 1]. For details see the Vega-Lite mark property documentation
Specify the stroke width of a mark in pixel units. For details see the Vega-Lite mark property documentation
Specify the names of custom styles to apply to the mark. Each name should refer to a named style defined in a separate style configuration. For details see the Vega-Lite mark property documentation
Specify the interpolation tension used if interpolating line and area marks. For details see the Vega-Lite line mark property documentation
Specify the placeholder text for a text mark for when a text channel is not specified. For details see the Vega-Lite text mark property documentation
Specify the polar coordinate angle, in radians, of a text mark from the
origin determined by its x and y properties. Values for theta follow the same
convention of arc mark startAngle and endAngle properties: angles are
measured in radians, with 0 indicating “north”. For details see the
Vega-Lite text mark property documentation
Specify the thickness of a tick mark. For details see the Vega-Lite tick mark property documentation
Indicates desired orientation of a mark (e.g. horizontally or vertically oriented bars.)
Indicates mark interpolation style. See the Vega-Lite documentation for details.
Identifies the type of symbol.
Note: The use of the Path type constructor is deprecated in favour of the
symbolPath function.
Specify a custom symbol shape with an SVG path description.
Represents the type of cursor to display. For an explanation of each type, see the CSS documentation
Specify the appearance of a point marker that is overlaid on a line or area mark. For details see the Vega-Lite point property documentation.
Specify the properties of a point marker that is overlaid on a line or area mark. For details see the Vega-Lite point property documentation.
Types and functions for declaring which data fields are mapped to which channels.
Channels can include position on screen (e.g. X,Y), visual mark properties
(e.g. color, size, stroke, shape), text, hyperlinks, ordering, level of detail and facets
(for composed visualizations). All can be further customised via a series of properties
for determining how that encoding is implemented (e.g. scaling, sorting, spacing).
Create an encoding specification from a list of channel encodings.
enc =
encoding
<< position X [ pName "Animal", pMType Ordinal ]
<< position Y [ pName "Age", pMType Quantitative ]
<< shape [ mName "Species", mMType Nominal ]
<< size [ mName "Population", mMType Quantitative ]Type of measurement to be associated with some channel. Nominal data are
categories identified by name alone and which have no intrinsic order. Ordinal
data are also categories, but ones which have some natural order. Quantitative
data are numeric measurements typically on a continuous scale. Temporal data
describe time.
Geospatial position encoding (Longitude and Latitude) should specify the pMType
as Quantitative. Geographically referenced features encoded as shape marks
should specify mMType as GeoFeature (Vega-Lite currently refers to this type
as geojson).
Relates to where something appears in the visualization.
Encode a position channel. The first parameter identifies the channel, the second a list of qualifying options. Usually these will include at least the name of the data field associated with it and its measurement type (either the field name directly, or a reference to a row / column repeat field). The final parameter is a list of any previous channels to which this position channel should be added. This is often implicit when chaining a series of encodings using functional composition.
enc =
encoding
<< position X [ pName "Animal", pMType Ordinal ]Encoding by position will generate an axis by default. To prevent the axis from
appearing, simply provide an empty list of axis properties to pAxis :
enc =
encoding
<< position X [ pName "Animal", pMType Ordinal, pAxis [] ]Type of position channel, X and Y represent horizontal and vertical axis
dimensions on a plane and X2 and Y2 represent secondary axis dimensions where
two scales are overlaid in the same space. Geographic positions represented by
longitude and latitude values are identified with Longitude, Latitude and
their respective secondary equivalents. Such geographic position channels are
subject to a map projection before being placed graphically.
Provide the name of the field used for encoding with a position channel. For details, see the Vega-Lite field documentation
Provide the name of the fields from a repeat operator used for encoding with a position channel. For details, see the Vega-Lite field documentation
Specify the field type (level of measurement) when encoding with a position channel. For details, see the Vega-Lite type documentation
Discretizes a series of numeric values into bins when encoding with a position channel. For details, see the Vega-Lite binning documentation
Specify the form of time unit aggregation of field values when encoding with a position channel. For details, see the Vega-Lite time unit documentation
Compute some aggregate summaray statistics for a field to be encoded with a position channel. The type of aggregation is determined by the given operation parameter. For details, see the Vega-Lite aggregate documentation
Specify the scaling applied to a field when encoding with a position channel. The scale will transform a field's value into a position along one axis. For details, see the Vega-Lite position field documentation
Specify the axis properties used when encoding with a position channel. For details, see the Vega-Lite position field documentation
Specify the sort order for field when encoding with a position channel. For details, see the Vega-Lite position field documentation
Specify the type of stacking offset for field when encoding with a position channel. For details, see the Vega-Lite position field documentation
Allow type of sorting to be customised. To sort a field by the aggregated
values of another use the soByField or soByRepeat functions rather than their
deprecated type constructor equivalents ByField and ByRepeat.
For details see the Vega-Lite sorting documentation.
Specify a sorting by the aggregated summary of a given field using a given
aggregation operation. For example, the following sorts the categorical data
field variety by the mean age of the data in each variety category.
position Y [ pName "variety"
, pMType Ordinal
, pSort [ soByField "age" Mean, Descending ]
]For details see the Vega-Lite sorting documentation.
Specify a sorting by the aggregated summaries of the given fields (referenced by a repeat iteration) using a given aggregation operation. For details see the Vega-Lite sorting documentation.
Provide a custom sort order by listing data values explicitly. This can be used in place of lists of SortProperty. For example,
let
data =
dataFromColumns []
<< dataColumn "a" (strs [ "A", "B", "C" ])
<< dataColumn "b" (nums [ 28, 55, 43 ])
enc =
encoding
<< position X
[ pName "a"
, pMType Ordinal
, pSort [ soCustom (strs [ "B", "A", "C" ]) ]
]
<< position Y [ pName "b", pMType Quantitative ]
in
toVegaLite [ data [], enc [], bar [] ]Describes the type of stacking to apply to a bar chart.
Specify whether or not the axis baseline (domain) should be included as part of an axis. For details see the Vega axis property documentation
Specify the format to apply to labels on an axis. For details see the Vega axis property documentation
Specify whether or not grid lones should be included as part of an axis. For details see the Vega axis property documentation
Specify the rotation angle in degrees of axis labels. For details see the Vega axis property documentation
Specify the overlap strategy for labels when they are too large to fit within the space devoted to an axis. For details see the Vega axis property documentation
Specify the padding in pixels between an axis and its text labels. For details see the Vega axis property documentation
Specify whether or not axis labels should be displayed. For details see the Vega axis property documentation
Specify the maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles. For details see the Vega axis property documentation
Specify the minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles. For details see the Vega axis property documentation
Specify the offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle. For details see the Vega axis property documentation
Specify the orientation of an axis relative to the plot it is describing. For details see the Vega axis property documentation
Specify the anchor position of the axis in pixels. For x-axis with top or bottom orientation, this sets the axis group x coordinate. For y-axis with left or right orientation, this sets the axis group y coordinate. For details see the Vega axis property documentation
Specify whether or not an axis should include tick marks. For details see the Vega axis property documentation
Specify the desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are “nice” (multiples of 2, 5, 10) and lie within the underlying scale’s range. For details see the Vega axis property documentation
Specify the tick mark size in pixels. For details see the Vega axis property documentation
Specify the title to display as part of an axis. An empty string can be used to prevent a title being displayed. For details see the Vega axis property documentation
Specify the horizontal alignment of an axis title. For details see the Vega axis property documentation
Specify the angle in degrees of an axis title. For details see the Vega axis property documentation
Specify the maximum length for an axis title for cases where the title is automatically generated from a field’s description. For details see the Vega axis property documentation
Specify the padding in pixels between a title and axis. For details see the Vega axis property documentation
Specify the numeric values to appear along an axis. For details see the Vega axis property documentation
Specify the date/times to appear along an axis. For details see the Vega axis property documentation
Specify the drawing order of the axis relative to the other chart elements. A value of 1 indicates axis is drawn in front of chart marks, 0 indicates it is drawn behind them. For details see the Vega axis property documentation
Type of overlap strategy to be applied when there is not space to show all items on an axis. See the Vega-Lite documentation for more details.
Represents one side of a rectangular space.
Indicates the horizontal alignment of some text such as on an axis or legend.
Indicates the vertical alignment of some text that may be attached to a mark.
Relate to the appearance of the visual marks in the visualization such as their color or size.
Encode a size channel. The first parameter is a list of mark channel properties that characterise the way a data field is encoded by size. The second parameter is a list of any previous channels to which this size channel should be added.
size [ mName "Age", mMType Quantitative ] []Encode a color channel. The first parameter is a list of mark channel properties that characterise the way a data field is encoded by color. The second parameter is a list of any previous channels to which this color channel should be added.
color [ mName "Species", mMType Nominal ] []Encoding a color channel will generate a legend by default. To stop the legend
appearing, just supply an empty list of legend properties to MLegend :
color [ mName "Species", mMType Nominal, mLegend [] ] []Encode a fill channel. This acts in a similar way to encoding by color but
only affects the interior of closed shapes. The first parameter is a list of mark
channel properties that characterise the way a data field is encoded by fill.
The second parameter is a list of any previous channels to which this fill channel
should be added.
fill [ mName "Species", mMType Nominal ] []Note that if both fill and color encodings are specified, fill takes precedence.
Encode a stroke channel. This acts in a similar way to encoding by color but
only affects the exterior boundary of marks. The first parameter is a list of mark
channel properties that characterise the way a data field is encoded by stroke.
The second parameter is a list of any previous channels to which this stroke channel
should be added.
stroke [ mName "Species", mMType Nominal ] []Note that if both stroke and color encodings are specified, stroke takes
precedence.
Encode an opacity channel. The first parameter is a list of mark channel properties that characterise the way a data field is encoded by opacity. The second parameter is a list of any previous channels to which this opacity channel should be added.
opacity [ mName "Age", mMType Quantitative ] []Encode a shape channel. The first parameter is a list of mark channel properties that characterise the way a data field is encoded by shape. The second parameter is a list of any previous channels to which this shape channel should be added.
shape [ mName "Species", mMType Nominal ] []Provide the name of the field used for encoding with a mark property channel. For details, see the Vega-Lite field documentation
Reference in a mark channel to a field name generated by repeat. The
parameter identifies whether reference is being made to fields that are to be
laid out in columns or in rows.
Specify the field type (level of measurement) when encoding with a mark property channel. For details, see the Vega-Lite type documentation
Specify the scaling applied to a field when encoding with a mark property channel. The scale will transform a field's value into a color, shape, size etc. For details, see the Vega-Lite position field documentation
Discretizes a series of numeric values into bins when encoding with a mark property channel. For details, see the Vega-Lite binning documentation
Specify the form of time unit aggregation of field values when encoding with a mark property channel. For details, see the Vega-Lite time unit documentation
Compute some aggregate summaray statistics for a field to be encoded with a mark property channel. The type of aggregation is determined by the given operation parameter. For details, see the Vega-Lite aggregate documentation
Specify the properties of a legend that describes a mark's encoding. To stop a legend from appearing provide an empty list as a parameter.
color [ mName "Animal", mMType Nominal, mLegend [] ]For details, see the Vega-Lite type documentation
Specify the properties of a mark channel conditional on interactive selection. The first parameter provides the selection to evaluate, the second the encoding to apply if the mark has been selected, the third the encoding if it is not selected.
color
[ mSelectionCondition (selectionName "myBrush")
[ mName "Cylinders", mMType Ordinal ]
[ mStr "grey" ]
]For details, see the Vega-Lite condition documentation
Specify the properties of a mark channel conditional on some predicate expression. The first parameter provides the expression to evaluate, the second the encoding to apply if the expression is true, the third the encoding if the expression is false.
color
[ mDataCondition
(expr "datum.IMDB_Rating === null")
[ mStr "#ddd" ]
[ mStr "rgb(76,120,168)" ]
]For details, see the Vega-Lite condition documentation
Provide an SVG path string when encoding with a mark property channel. Useful when providing custom shapes.
Provide a literal numeric value when encoding with a mark property channel.
Provide a literal string value when encoding with a mark property channel.
Provide a literal Boolean value when encoding with a mark property channel.
Specify the padding in pixels between legend entries. For more detail see the Vega-Lite legend property documentation.
Specify the formatting pattern for legend labels. For more detail see the Vega-Lite legend property documentation.
Specify the offset in pixels of a legend from the edge of its enclosing group / data rectangle. For more detail see the Vega-Lite legend property documentation.
Specify the position of a legend in a scene. For more detail see the Vega-Lite legend property documentation.
Specify the padding in pixels between a legend and axis. For more detail see the Vega-Lite legend property documentation.
Specify the number of tick marks in a quantitative legend. For more detail see the Vega-Lite legend property documentation.
Specify the title of a legend. For more detail see the Vega-Lite legend property documentation.
Specify the type of legend (discrete symbols or continuous gradients). For more detail see the Vega-Lite legend property documentation.
Specify the legend values explicitly. For more detail see the Vega-Lite legend property documentation.
Specify the drawing order of a legend relative to other chart elements. To place a legend in front of others use a positive integer, or 0 to draw behind. For more detail see the Vega-Lite legend property documentation.
Indicates the type of legend to create. Gradient legends are usually used for continuous quantitative data while symbol legends used for categorical data.
Indicates the legend orientation. See the Vega-Lite documentation for more details.
Specify a set of legend numeric values explicitly.
Specify a set of legend strings explicitly.
Specify a set of legend date-times explicitly.
Relate to the appearance of the text and tooltip elements of the visualization.
Encode a text channel. The first parameter is a list of text channel properties that define the channel. The second parameter is a list of any previous channels to which this channel is to be added. This is usually implicit when chaining a set of encodings together with functional composition. See the Vega-Lite documentation for further details on the text and tooltip channels and Vega-Lite formatting documentation for formatting the appearance of the text.
enc =
encoding
<< position X [ pName "miles", pMType Quantitative ]
<< position Y [ pName "gas", pMType Quantitative ]
<< text [ tName "miles", tMType Quantitative ]Encode a tooltip channel. The first parameter is a list of text channel properties that define the channel. The second parameter is a list of any previous channels to which this channel is to be added. This is usually implicit when chaining a set of encodings together with functional composition. See the Vega-Lite documentation for further details on the text and tooltip channels and Vega-Lite formatting documentation for formatting the appearance of the text.
enc =
encoding
<< position X [ pName "Horsepower", pMType Quantitative ]
<< position Y [ pName "Miles_per_Gallon", pMType Quantitative ]
<< tooltip [ tName "Year", tMType Temporal, tFormat "%Y" ]To encode multiple tooltip values with a mark, use tooltips
Encode a tooltip channel with multiple tooltips. The first parameter is a list of the multiple tooltips, each of which is a list of text channel properties that define the channel. The second parameter is a list of any previous channels to which this channel is to be added. See the Vega-Lite documentation for further details on the text and tooltip channels and Vega-Lite formatting documentation for formatting the appearance of the text.
enc =
encoding
<< position X [ pName "Horsepower", pMType Quantitative ]
<< position Y [ pName "Miles_per_Gallon", pMType Quantitative ]
<< tooltips [ [ tName "Year", tMType Temporal, tFormat "%Y" ]
, [ tName "Cylinders", tMType Quantitative ]
]Provide the name of the field used for encoding with a text channel. For details, see the Vega-Lite field documentation
Reference in a text channel to a field name generated by repeat. The
parameter identifies whether reference is being made to fields that are to be
laid out in columns or in rows.
Specify the field type (level of measurement) when encoding with a text channel. For details, see the Vega-Lite type documentation
Discretizes a series of numeric values into bins when encoding with a text channel. For details, see the Vega-Lite binning documentation
Compute some aggregate summaray statistics for a field to be encoded with a text channel. The type of aggregation is determined by the given operation parameter. For details, see the Vega-Lite aggregate documentation
Specify the form of time unit aggregation of field values when encoding with a text channel. For details, see the Vega-Lite time unit documentation
Specify the properties of a text channel conditional on interactive selection. The first parameter provides the selection to evaluate, the second the encoding to apply if the text has been selected, the third the encoding if it is not selected. For details, see the Vega-Lite condition documentation
Specify the properties of a text channel conditional on some predicate expression. The first parameter provides the expression to evaluate, the second the encoding to apply if the expression is true, the third the encoding if the expression is false. For details, see the Vega-Lite condition documentation
Provide a formatting pattern for a field when encoding with a text channel.
Indicates the weight options for a font.
Relates to a clickable URL destination of a mark. Note that unlike most other channels, the hyperlink channel has no direct visual expression other than the option of changing the cursor style when hovering, so an encoding will usually pair hyperlinks with other visual channels such as marks or texts.
Encode a hyperlink channel. The first parameter is a list of hyperlink channel properties that characterise the hyperlinking such as the destination URL and cursor type. The second parameter is a list of any previous encoding channels to which this hyperlink channel should be added.
hyperlink [ hName "Species", hMType Nominal ] []For further details see the Vega-Lite documentation
Provide the name of the field used for encoding with a hyperlink channel. For details, see the Vega-Lite field documentation
Reference in a hyperlink channel to a field name generated by repeat. The
parameter identifies whether reference is being made to fields being laid out
in columns or in rows.
Specify the field type (level of measurement) when encoding with a hyperlink channel. For details, see the Vega-Lite type documentation
Discretizes a series of numeric values into bins when encoding with a hyperlink channel. For details, see the Vega-Lite binning documentation
Compute some aggregate summaray statistics for a field to be encoded with a hyperlink channel. The type of aggregation is determined by the given operation parameter. For details, see the Vega-Lite aggregate documentation
Specify the form of time unit aggregation of field values when encoding with a hyperlink channel. For details, see the Vega-Lite time unit documentation
Specify the properties of a hyperlink channel conditional on some predicate expression. The first parameter provides the expression to evaluate, the second the encoding to apply if the expression is true, the third the encoding if the expression is false. For details, see the Vega-Lite condition documentation
Specify the properties of a hyperlink channel conditional on interactive selection. The first parameter provides the selection to evaluate, the second the encoding to apply if the hyperlink has been selected, the third the encoding if it is not selected. For details, see the Vega-Lite condition documentation
Provide a literal string value when encoding with a hyperlink channel.
Channels that relate to the order of data fields such as for sorting stacking order or order of data points in a connected scatterplot. See the Vega-Lite documentation for further details.
Encode an order channel. The first parameter is a list of order field definitions to define the channel. The second parameter is a list of any previous channels to which this order channel is to be added.
enc =
encoding
<< position X [ pName "miles", pMType Quantitative ]
<< position Y [ pName "gas", pMType Quantitative ]
<< order [ oName "year", oMType Temporal ]Provide the name of the field used for encoding with an order channel. For details, see the Vega-Lite field documentation
Reference in a order channel to a field name generated by repeat. The
parameter identifies whether reference is being made to fields that are to be
laid out in columns or in rows.
Specify the field type (level of measurement) when encoding with an order channel. For details, see the Vega-Lite type documentation
Discretizes a series of numeric values into bins when encoding with an order channel. For details, see the Vega-Lite binning documentation
Compute some aggregate summaray statistics for a field to be encoded with an order channel. The type of aggregation is determined by the given operation parameter. For details, see the Vega-Lite aggregate documentation
Specify the sort order to be used by an order channel. Vega-Lite order field documentation
Specify the form of time unit aggregation of field values when encoding with an order channel. For details, see the Vega-Lite time unit documentation
Channels for faceting single plots into small multiples. Can be used to create trellis plots or other arrangements in rows and columns. See the Vega-Lite documentation for further details. See also, 'faceted view composition' for a more flexible (but more verbose) way of defining faceted views.
Encode a new facet to be arranged in rows. The first parameter is a list of facet properties that define the faceting channel. This should include at least the name of data the field and its measurement type. The final parameter is a list of any previous channels to which this is to be added. This is usually implicit when chaining encodings using functional composition
enc =
encoding
<< position X [ pName "people", pMType Quantitative ]
<< position Y [ pName "gender", pMType Nominal ]
<< row [ fName "age", fMType Ordinal ]Encodes a new facet to be arranged in columns. The first parameter is a list of properties that define the faceting channel. This should include at least the name of the data field and its measurement type. The final parameter is a list of any previous channels to which this is to be added. This is usually implicit when chaining encodings using functional composition
enc =
encoding
<< position X [ pName "people", pMType Quantitative ]
<< position Y [ pName "gender", pMType Nominal ]
<< column [ fName "age", fMType Ordinal ]Used for grouping data but without changing the visual appearance of a mark. When, for example, a field is encoded by color, all data items with the same value for that field are given the same color. When a detail channel encodes a field, all data items with the same value are placed in the same group. This allows, for example a line chart with multiple lines to be created – one for each group. See the Vega-Lite documentation for more information.
Encode a 'level of detail' channel. This provides a way of grouping by a field
but unlike, say color, all groups have the same visual properties. The first
parameter is a list of the field characteristics to be grouped. The second parameter
is a list of any previous channels to which this detail channel should be added. See the
Vega-Lite documentation
for details.
detail [ dName "Species", dMType Nominal ] []Provide the name of the field used for encoding with a level of detail (grouping) channel. For details, see the Vega-Lite field documentation
Specify the field type (level of measurement) when encoding with a level of detail (grouping) channel. For details, see the Vega-Lite type documentation
Compute some aggregate summaray statistics for a field to be encoded with a level of detail (grouping) channel. The type of aggregation is determined by the given operation parameter. For details, see the Vega-Lite aggregate documentation
Discretizes a series of numeric values into bins when encoding with a level of detail (grouping) channel. For details, see the Vega-Lite binning documentation
Specify the form of time unit aggregation of field values when encoding with a level of detail (grouping) channel. For details, see the Vega-Lite time unit documentation
Used to specify how the encoding of a data field should be applied.
Specify the type of scaling to apply. For details see the Vega-Lite scale type documentation
Specify a custom scaling domain. For details see the Vega-Lite scale domain documentation
Specify the range of a scaling. The type of range depends on the encoding channel. For details see the Vega-Lite scale range documentation
Specify the color scheme used by a color scaling. For details see the Vega-Lite scale color scheme documentation
Specify the padding in pixels to apply to a scaling. For details see the Vega-Lite scale documentation
Specify the inner padding in pixels to apply to a band scaling. For details see the Vega-Lite band scale documentation
Specify the outer padding in pixels to apply to a band scaling. For details see the Vega-Lite band scale documentation
Specify the distance in pixels between the starts of adjacent bands in a band
scaling. If Nothing is provided the distance is determined automatically.
For details see the
Vega-Lite band scale documentation
Specify whether or not numeric values in a scaling are rounded to integers. For details see the Vega-Lite scale documentation
Specify that when scaling, values outside the data domain are clamped to the minimum or maximum value. For details see the Vega-Lite scale documentation
Specify an interpolation method for scaling range values. For details see the Vega-Lite scale documentation
Specify 'nice' minimum and maximum values in a scaling (e.g. multiples of 10). For details see the Vega-Lite scale documentation
Specify whether or not a numeric scaling should be forced to include a zero value. For details see the Vega-Lite scale documentation
Reverse the order of a scaling. For details see the Vega scale documentation
Used to indicate the type of scale transformation to apply.
Specify the name of a pre-defined scale range (e.g. symbol or diverging).
For details see the
Vega-Lite documentation
Specify a numeric scale range. Depending on the scaling this may be a min,max pair, or a list of explicit numerical values. For details see the Vega-Lite documentation
Specify a text scale range for discrete scales. For details see the Vega-Lite documentation
Create a set of discrete domain to color mappings suitable for customising categorical
scales. The first item in each tuple should be a domain value and the second the
color value with which it should be associated. It is a convenience function equivalent
to specifying separate SDomain and SRange lists and is safer as it guarantees
a one-to-one correspondence between domain and range values.
color
[ mName "weather"
, mMType Nominal
, mScale <|
categoricalDomainMap
[ ( "sun", "yellow" )
, ( "rain", "blue" )
, ( "fog", "grey" )
]
]Create a pair of continuous domain to color mappings suitable for customising
ordered scales. The first parameter is a tuple representing the mapping of the lowest
numeric value in the domain to its equivalent color; the second tuple the mapping
of the highest numeric value to color. If the domain contains any values between
these lower and upper bounds they are interpolated according to the scale's interpolation
function. This is a convenience function equivalent to specifying separate SDomain
and SRange lists and is safer as it guarantees a one-to-one correspondence between
domain and range values.
color
[ mName "year"
, mMType Ordinal
, mScale (domainRangeMap ( 1955, "#e6959c" ) ( 2000, "#911a24" ))
]Describes a scale domain (type of data in scale). To specify scale domain
values explicitly, use the functions doNums, doStrs, doDts or doSelection
rather than their (deprecated) type constructor equivalents.
For full details see the Vega-Lite documentation.
Specify the numeric values that define a scale domain. For full details see the Vega-Lite documentation.
Specify the string values that define a scale domain. For full details see the Vega-Lite documentation.
Specify the date-time values that define a scale domain. For full details see the Vega-Lite documentation.
Specify a scale domain based on a named interactive selection. For full details see the Vega-Lite documentation.
Describes the way a scale can be rounded to 'nice' numbers. To specify nice
time intervals use scNiceInterval rather then the deprecated type constructor
NInterval; to switch nice scaling on or off use scIsNice rather than the
deprecated type constructor IsNice; and to set a nice tick count use the
scNiceTickCount function rather than the deprecated NTickCount type constructor.
For details see the Vega-Lite documentation.
Specify whether or not a scaling should use 'nice' values. For details see Vega-Lite documentation.
Specify the desired number of tick marks in a 'nice' scaling. For details see Vega-Lite documentation.
Specify the 'nice' temporal interval values when scaling. For details see Vega-Lite documentation.
Indicates the type of color interpolation to apply, when mapping a data field
onto a color scale. Note that color interpolation cannot be applied with the default
sequential color scale, so additionally, you should set the sType to another
continuous scale such as linear, pow etc.
Several of the interpolation options also require a gamma value (with 1 being
a recommended default to provide). These should be generated with the named functions
cubeHelix, cubeHelixLong and rgb rather than with a (deprecated) type constructor.
For details see the Vega-Lite documentation.
Specify a cube helix color interpolation for continuous color scales. The parameter is the gamma value to use in interpolation (anchored at 1).
Specify a long-path cube helix color interpolation for continuous color scales. The parameter is the gamma value to use in interpolation (anchored at 1).
Specify an RGB color interpolation for continuous color scales. The parameter is the gamma value to use in interpolation (anchored at 1).
Views can be combined to create more complex multiview displays. This may involve
layering views on top of each other (superposition) or laying them out in adjacent
spaces (juxtaposition using repeat, facet, hConcat or vConcat). Where different
views have potentially conflicting channels (for example, two position scales in
a layered visualization) the rules for resolving them can be defined with resolve.
For details of creating composite views see the
Vega-Lite documentation
Assigns a list of specifications to superposed layers in a visualization.
let
spec1 = ...
spec2 = ...
in
toVegaLite
[ dataFromUrl "data/driving.json" []
, layer [ spec1, spec2 ]
]Assigns a list of specifications to be juxtaposed horizontally in a visualization.
let
spec1 = ...
spec2 = ...
in
toVegaLite
[ dataFromUrl "data/driving.json" []
, hConcat [ spec1, spec2 ]
]Assigns a list of specifications to be juxtaposed vertically in a visualization.
let
spec1 = ...
spec2 = ...
in
toVegaLite
[ dataFromUrl "data/driving.json" []
, vConcat [ spec1, spec2 ]
]Determine whether scales, axes or legends in composite views should share channel encodings. This allows, for example, two different color encodings to be created in a layered view, which otherwise by default would share color channels between layers. Each resolution rule should be in a tuple pairing the channel to which it applies and the rule type.
let
res =
resolve
<< resolution (reLegend [ ( ChColor, Independent ) ])
in
toVegaLite
[ dataFromUrl "data/movies.json" []
, vConcat [ heatSpec, barSpec ]
, res []
]For more information see the Vega-Lite documentation.
Define a single resolution option to be applied when scales, axes or legends in composite views share channel encodings. This allows, for example, two different color encodings to be created in a layered view, which otherwise by default would share color channels between layers. Each resolution rule should be in a tuple pairing the channel to which it applies and the rule type. The first parameter identifies the type of resolution, the second a list of previous resolutions to which this one may be added.
resolve
<< resolution (reScale [ ( ChY, Independent ) ])Specify how a channel's axes should be resolved when defined in more than one view in a composite visualization. See the Vega-Lite documentation for details.
Specify how a channel's legends should be resolved when defined in more than one view in a composite visualization. See the Vega-Lite documentation for details.
Specify how a channel's scales should be resolved when defined in more than one view in a composite visualization. See the Vega-Lite documentation for details.
Indicates a channel type to be used in a resolution specification.
Indicated whether or not a scale domain should be independent of others in a composite visualization. See the Vega-Lite documentation for details.
These are small multiples each of which show subsets of the same dataset. The specification determines which field should be used to determine subsets along with their spatial arrangement (in rows or columns). For details see the Vega-Lite documentation
Define the fields that will be used to compose rows and columns of a set of
small multiples. This is used where the encoding of the visualization in small
multiples is largely identical, but the data field used in each might vary. When
a list of fields is identified with repeat you also need to define a full specification
to apply to each of those fields using asSpec.
spec = ...
toVegaLite
[ repeat [ columnFields [ "Cat", "Dog", "Fish" ] ]
, specification (asSpec spec)
]See the Vega-Lite documentation for further details.
Create a list of fields to use in set of repeated small multiples arranged in
rows. The list of fields named here can be referenced in an encoding with
pRepeat Row, mRepeat Row etc.
Create a list of fields to use in set of repeated small multiples arranged in
columns. The list of fields named here can be referenced in an encoding with
pRepeat Column, mRepeat Column etc.
Defines the fields that will be used to facet a view in rows or columns to create
a set of small multiples. This is used where the encoding of the visualization in small
multiples is identical, but data for each is grouped by the given fields. When
creating a faceted view in this way you also need to define a full specification
to apply to each of those facets using asSpec.
spec = ...
toVegaLite
[ facet [ rowBy [ fName "Origin", fMType Nominal ] ]
, specifcation spec
]See the Vega-Lite documentation for further details.
Specify the mapping between a column and its field definitions in a set of faceted small multiples. For details see the Vega-Lite documentation
Specify the mapping between a row and its field definitions in a set of faceted small multiples. For details see the Vega-Lite documentation
Provide the name of the field used for encoding with a facet channel. For details, see the Vega-Lite field documentation
Specify the field type (level of measurement) when encoding with a facet channel. For details, see the Vega-Lite type documentation
Compute some aggregate summaray statistics for a field to be encoded with a facet channel. The type of aggregation is determined by the given operation parameter. For details, see the Vega-Lite aggregate documentation
Discretizes a series of numeric values into bins when encoding with a facet channel. For details, see the Vega-Lite binning documentation
Specify the 'axis' for a series of faceted plots. This is the guide that spans the collection of faceted plots, each of which may have their own axes. For details, see the Vega-Lite facet header documentation
Specify the form of time unit aggregation of field values when encoding with a facet channel. For details, see the Vega-Lite time unit documentation
Create a specification sufficient to define an element in a composed visualization such as a superposed layer or juxtaposed facet. Typically a layer will contain a full set of specifications that define a visualization with the exception of the data specification which is usually defined outside of any one layer. Whereas for repeated and faceted specs, the entire specification is provided.
enc1 = ...
spec1 =
asSpec [ enc1, line [] ]Defines a specification object for use with faceted and repeated small multiples.
spec = ...
toVegaLite
[ facet [ rowBy [ fName "Origin", fMType Nominal ] ]
, specifcation spec
]Identifies whether a repeated/faceted view is arranged in rows or columns.
Specify a header title in a faceted view. For details, see the Vega-Lite documentation
Header format specifier for a faceted view. For details, see the Vega-Lite documentation
Selections are the way in which interactions (such as clicking or dragging) can be responded to in a visualization. They transform interactions into data queries. For details, see the Vega-Lite documentation.
Create a full selection specification from a list of selections. For details see the Vega-Lite documentation.
selection =
selection << select "view" Interval [ BindScales ]Create a single named selection that may be applied to a data query or transformation. The first two parameters specify the name to be given to the selection for later reference and the type of selection made. The third allows additional selection options to be specified. The fourth is a list of selections to which this is added, which is commonly implicit when chaining a series of selections together with functional composition.
sel =
selection
<< select "view" Interval [ BindScales ] []
<< select "myBrush" Interval []
<< select "myPaintbrush" Multi [ On "mouseover", Nearest True ]Indicates the type of selection to be generated by the user. Single allows
one mark at a time to be selected. 'Multi' allows multiple items to be selected
(e.g. with shift-click). 'Interval' allows a bounding rectangle to be dragged by
user to select all items intersecting with it.
Properties for customising the nature of an interactive selection. See the
Vega-Lite documentation
for details. For parameterised properties use relevant functions (e.g. seOn,
seEncodings, seBind etc.) rather than the (deprecated) type constructors
(On, Encodings, Bind etc.).
Specify a binding to some input elements as part of a named selection. For details, see the Vega-Lite bind documentation
Specify a encoding channels that form a named selection. For details, see the Vega-Lite selection documentation
Specify the field names for projecting a selection. For details, see the Vega-Lite projection selection documentation
Specify whether or not a selection should capture nearest marks to a pointer rather than an exact position match. This allows 'accelerated' selection for discrete marks. For details, see the Vega-Lite nearest documentation
Specify a Vega event stream that triggers a selection. For details, see the Vega-Lite selection documentation
Specify a strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain. For details, see the Vega-Lite selection documentation
Specify the appearance of an interval selection mark (dragged rectangle). For details, see the Vega-Lite selection documentation
Specify a predicate expression that determines a toggled selection. For details, see the Vega-Lite toggle documentation
Specify a translation selection transformation used for panning a view. For details, see the Vega-Lite selection translate documentation
Specify a zooming selection transformation used for zooming a view. For details, see the Vega-Lite selection zoom documentation
Specify a range slider input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a checkbox input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a radio box input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a select input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a text input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a number input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a date input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a time input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a month input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a week input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a local time input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a telephone number input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify a color input element that can bound to a named field value (first parameter. For details see the Vega-Lite input element binding documentation and the Vega input binding documentation
Specify the delay in input event handling when processing input events in order to avoid unnecessary event broadcasting. For details see the Vega-Lite input element documentation
Specify an optional CSS selector indicating the parent element to which an input element should be added. This allows the option of the input element to be outside the visualization container. For details see the Vega-Lite input element documentation
Specify a range of options for a radio or select input element. For details see the Vega-Lite input element documentation
Specify the minimum slider value for a range input element. Defaults to the smaller of the signal value and 0. For details see the Vega-Lite input element documentation
Specify the maximum slider value for a range input element. Defaults to the larger of the signal value and 100. For details see the Vega-Lite input element documentation
Specify a custom label for a radio or select input element. For details see the Vega-Lite input element documentation
Specify the minimum input element range slider increment. If undefined, the step size will be automatically determined based on the min and max values. For details see the Vega-Lite input element documentation
Specify the initial placeholding text for input elements such as text fields. For details see the Vega-Lite input element documentation
Determines how selections in faceted or repeated views are resolved. See the Vege-Lite documentation for details
Specify the fill color of the interval selection mark (dragged rectangular area). For details see the Vega-Lite documentation.
Specify the fill opacity of the interval selection mark (dragged rectangular area) in the range [0, 1]. For details see the Vega-Lite documentation.
Specify the stroke color of the interval selection mark (dragged rectangular area). For details see the Vega-Lite documentation.
Specify the stroke dash style of the interval selection mark (dragged rectangular area). For details see the Vega-Lite documentation.
Specify the stroke dash offset of the interval selection mark (dragged rectangular area). For details see the Vega-Lite documentation.
Specify the stroke opacity of the interval selection mark (dragged rectangular area) in the range [0, 1]. For details see the Vega-Lite documentation.
Specify the stroke width of the interval selection mark (dragged rectangular area). For details see the Vega-Lite documentation.
Sometimes it is useful to make channel encoding conditional on something. For example,
on the result of some interaction such as clicking or dragging or some data property
such whether null or an outlier. MSelectionCondition (and TSelectionCondition) will
encode a mark (or text) dependent on an interactive selection. MDataCondition
(and TDataCondition) will encode it depending on some data property.
For interaction, once a selection has been defined and named, supplying a set of
MSelectionCondition encodings allow mark encodings to become dependent on that selection.
MSelectionCondition is followed firstly by a Boolean expression relating to the
selection upon which it is dependent, then an 'if' and an 'else' clause. Each clause
is a list of mark field encodings that should be applied when the selection is true
(the 'if clause') and when it is false (the 'else clause'). The color encoding below
is saying "whenever data marks are selected with an interval mouse drag, encode
the cylinder field with an ordinal color scheme, else make them grey".
sel =
selection << select "myBrush" Interval []
enc =
encoding
<< position X [ pName "Horsepower", pMType Quantitative ]
<< position Y [ pName "Miles_per_Gallon", pMType Quantitative ]
<< color
[ mSelectionCondition (selectionName "myBrush")
[ mName "Cylinders", mMType Ordinal ]
[ mStr "grey" ]
]In a similar way, MDataCondition will encocode a mark in one of two ways depending
on whether a predicate test is satisfied.
enc =
encoding
<< position X [ pName "IMDB_Rating", pMType Quantitative ]
<< position Y [ pName "Rotten_Tomatoes_Rating", pMType Quantitative ]
<< color
[ mDataCondition
(or (expr "datum.IMDB_Rating === null")
(expr "datum.Rotten_Tomatoes_Rating === null")
)
[ mStr "#ddd" ]
[ mStr "#0099ee" ]
]For details, see the Vega-Lite documentation.
Apply an 'and' Boolean operation as part of a logical composition.
and (expr "datum.IMDB_Rating === null") (expr "datum.Rotten_Tomatoes_Rating === null")Apply an 'or' Boolean operation as part of a logical composition.
color
[ mSelectionCondition (or (selectionName "alex") (selectionName "morgan"))
[ mAggregate Count, mName "*", mMType Quantitative ]
[ mStr "gray" ]
]Apply a negation Boolean operation as part of a logical composition. Boolean operations can be nested to any level, for example:
not (and (expr "datum.IMDB_Rating === null") (expr "datum.Rotten_Tomatoes_Rating === null") )Specify an expression that should evaluate to either true or false. Can use any valid Vega expression.
Provide an interactive selection that will be true or false as part of a logical composition. For example, to filter a dataset so that only items selected interactively and that have a weight of more than 30:
transform
<< filter (fCompose (and (selected "brush") (expr "datum.weight > 30")))Provide the name of a selection that is used as part of a conditional encoding.
color
[ mSelectionCondition (selectionName "myBrush")
[ mName "Origin", mMType Nominal ]
[ mStr "grey" ]
]Configuration options that affect the entire visualization. These are in addition to the data and transform options described above.
Provides an optional name to be associated with the visualization.
enc = ...
toVegaLite
[ name "PopGrowth"
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Provide an optional title to be displayed in the visualization.
enc = ...
toVegaLite
[ title "Population Growth"
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Provides an optional description to be associated with the visualization.
enc = ...
toVegaLite
[ description "Population change of key regions since 1900"
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Overrides the default height of the visualization. If not specified the height will be calculated based on the content of the visualization.
enc = ...
toVegaLite
[ height 300
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Override the default width of the visualization. If not specified the width will be calculated based on the content of the visualization.
enc = ...
toVegaLite
[ width 500
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Set the padding around the visualization in pixel units. The way padding is
interpreted will depend on the autosize properties. See the
Vega-Lite documentation
for details.
enc = ...
toVegaLite
[ width 500
, padding (paEdges 20 10 5 15)
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Specify a uniform padding around a visualization in pixel units.
Specify padding around a visualization in pixel units. The four parameters refer to left, top, right, and bottom edges respectively.
Declare the way the view is sized. See the Vega-Lite documentation for details.
enc = ...
toVegaLite
[ width 250
, height 300
, autosize [ AFit, APadding, AResize ]
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Set the background color of the visualization. Should be specified with a CSS
string such as #ffe or rgb(200,20,150). If not specified the background will
be transparent.
enc = ...
toVegaLite
[ background "rgb(251,247,238)"
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Create a single global configuration from a list of configuration specifications. Configurations are applied to all relevant items in the specification. See the Vega-Lite documentation for more details.
config =
configure
<< configuration (coAxis [ axcoDomainWidth 1 ])
<< configuration (coView [ vicoStroke Nothing ])
<< configuration (coSelection [ ( Single, [ seOn "dblclick" ] ) ])Defines a single configuration option to be applied globally across the visualization. The first parameter identifies the type of configuration, the second a list of previous configurations to which this one may be added.
configuration (coAxis [ axcoDomainWidth 4 ]) []Configure the default appearance of area marks. For details, see the Vega-Lite mark configuration documentation
Configure the default sizing of visualizations. For details, see the Vega-Lite top-level configuration documentation
Configure the default appearance of axes. For details, see the Vega-Lite axis configuration documentation
Configure the default appearance of x-axes. For details, see the Vega-Lite axis configuration documentation
Configure the default appearance of y-axes. For details, see the Vega-Lite axis configuration documentation
Configure the default appearance of left-side axes. For details, see the Vega-Lite axis configuration documentation
Configure the default appearance of right-side axes. For details, see the Vega-Lite axis configuration documentation
Configure the default appearance of top-side axes. For details, see the Vega-Lite axis configuration documentation
Configure the default appearance of bottom-side axes. For details, see the Vega-Lite axis configuration documentation
Configure the default appearance of axes with band scaling. For details, see the Vega-Lite axis configuration documentation
Configure the default background color of visualizations. For details, see the Vega-Lite top-level configuration documentation
Configure the default appearance of bar marks. For details, see the Vega-Lite mark configuration documentation
Configure the default appearance of circle marks. For details, see the Vega-Lite mark configuration documentation
Configure the default title style for count fields. For details, see the Vega-Lite top-level configuration documentation
Configure the default title generation style for fields. For details, see the Vega-Lite top-level configuration documentation
Configure the default appearance of geoshape marks. For details, see the Vega-Lite mark configuration documentation
Configure the default appearance of legends. For details, see the Vega-Lite legend configuration documentation
Configure the default appearance of line marks. For details, see the Vega-Lite mark configuration documentation
Configure the default mark appearance. For details, see the Vega-Lite mark configuration documentation
Configure the default appearance of a named style. For details, see the Vega-Lite mark style configuration documentation
Configure the default number formatting for axis and text labels. For details, see the Vega-Lite top-level configuration documentation
Configure the default padding in pixels from the edge of the of visualization to the data rectangle. For details, see the Vega-Lite top-level configuration documentation
Configure the default appearance of point marks. For details, see the Vega-Lite mark configuration documentation
Configure the default style of map projections. For details, see the Vega-Lite projection configuration documentation
Configure the default range properties used when scaling. For details, see the Vega-Lite scale range configuration documentation
Configure the default appearance of rectangle marks. For details, see the Vega-Lite mark configuration documentation
Configure the default handling of invalid (null and NaN) values. If true,
invalid values are skipped or filtered out when represented as marks. For details, see the
Vega-Lite mark configuration documentation
Configure the default appearance of rule marks. For details, see the Vega-Lite mark configuration documentation
Configure the default scale properties used when scaling. For details, see the Vega-Lite scale configuration documentation
Configure the default appearance of selection marks. For details, see the Vega-Lite documentation
Configure the default appearance of square marks. For details, see the Vega-Lite mark configuration documentation
Configure the default stack offset style for stackable marks. For details, see the Vega-Lite top-level configuration documentation
Configure the default appearance of text marks. For details, see the Vega-Lite mark configuration documentation
Configure the default appearance of tick marks. For details, see the Vega-Lite mark configuration documentation
Configure the default style of visualization titles. For details, see the Vega-Lite title configuration documentation
Configure the default time format for axis and legend labels. For details, see the Vega-Lite top-level configuration documentation
Specify the default style of trail marks.
config =
configure << coTrail [ maOpacity 0.5, maStrokeDash [ 1, 2 ] ]Configure the default single view style. For details, see the Vega-Lite view configuration documentation
Indicates the auto-sizing characteristics of the visualization such as amount of padding, whether it should fill the parent container etc. For more details see the Vega-Lite documentation
Specify a default axis band position. For more details, see the Vega-Lite axis config documentation.
Specify whether or not an axis domain should be displayed by default. For more details, see the Vega-Lite axis config documentation.
Specify a default axis domain color. For more details, see the Vega-Lite axis config documentation.
Specify a default axis domain width style. For more details, see the Vega-Lite axis config documentation.
Specify a default maximum extent style. For more details, see the Vega-Lite axis config documentation.
Specify a default minimum extent style. For more details, see the Vega-Lite axis config documentation.
Specify whether or not an axis grid is displayed by default. For more details, see the Vega-Lite axis config documentation.
Specify a default axis grid color style. For more details, see the Vega-Lite axis config documentation.
Specify a default axis line dash style. For more details, see the Vega-Lite axis config documentation.
Specify a default axis grid line opacity. For more details, see the Vega-Lite axis config documentation.
Specify a default axis grid line width. For more details, see the Vega-Lite axis config documentation.
Specify whether or not an axis has labels by default. For more details, see the Vega-Lite axis config documentation.
Specify a default axis label angle. For more details, see the Vega-Lite axis config documentation.
Specify a default axis label color. For more details, see the Vega-Lite axis config documentation.
Specify a default axis label font. For more details, see the Vega-Lite axis config documentation.
Specify a default axis label font size. For more details, see the Vega-Lite axis config documentation.
Specify a default axis label limit (how much a label can extend beyond the left/bottom or right/top of the axis line). For more details, see the Vega-Lite axis config documentation.
Specify a default axis label overlap strategy for cases where labels cannot fit within the allotted space. For more details, see the Vega-Lite axis config documentation.
Specify a default axis label padding (space between labels in pixels). For more details, see the Vega-Lite axis config documentation.
Specify whether or not an axis should use short time labels by default. For more details, see the Vega-Lite axis config documentation.
Specify whether or not an axis should show ticks by default. For more details, see the Vega-Lite axis config documentation.
Specify a default axis tick mark color. For more details, see the Vega-Lite axis config documentation.
Specify whether or not axis tick labels use rounded values by default. For more details, see the Vega-Lite axis config documentation.
Specify a default axis tick mark size in pixel units. For more details, see the Vega-Lite axis config documentation.
Specify a default axis tick mark width in pixel units. For more details, see the Vega-Lite axis config documentation.
Specify a default axis tick label horizontal alignment. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title angle. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title vertical alignment. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title color. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title font. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title font weight. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title font size. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title maximum size. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title maximum length when generated automatically from a field's description. For more details, see the Vega-Lite axis config documentation.
Specify a default axis title padding between axis line and text. For more details, see the Vega-Lite axis config documentation.
Specify a default axis x-position relative to the axis group. For more details, see the Vega-Lite axis config documentation.
Specify a default axis y-position relative to the axis group. For more details, see the Vega-Lite axis config documentation.
Specify a default legend corner radius. For more detail see the Vega-Lite documentation.
Specify a default background legend color. For more detail see the Vega-Lite documentation.
Specify a default legend position relative to the main plot content. For more detail see the Vega-Lite documentation.
Specify a default offset in pixel units between the legend and the enclosing group or data rectangle. For more detail see the Vega-Lite documentation.
Specify a default legend border color. For more detail see the Vega-Lite documentation.
Specify a default legend border stroke dash style. For more detail see the Vega-Lite documentation.
Specify a default legend border stroke width. For more detail see the Vega-Lite documentation.
Specify a default spacing in pixel units between a legend and axis. For more detail see the Vega-Lite documentation.
Specify a default vertical alignment for labels in a color ramp legend. For more detail see the Vega-Lite documentation.
Specify a default maximum allowable length for labels in a color ramp legend. For more detail see the Vega-Lite documentation.
Specify a default vertical offset in pixel units for labels in a color ramp legend. For more detail see the Vega-Lite documentation.
Specify a default color for strokes in a color ramp legend. For more detail see the Vega-Lite documentation.
Specify a default width for strokes in a color ramp legend. For more detail see the Vega-Lite documentation.
Specify a default height of a color ramp legend. For more detail see the Vega-Lite documentation.
Specify a default width of a color ramp legend. For more detail see the Vega-Lite documentation.
Specify a default horizontal alignment of legend labels. For more detail see the Vega-Lite documentation.
Specify a default vertical alignment of legend labels. For more detail see the Vega-Lite documentation.
Specify a default color for legend labels. For more detail see the Vega-Lite documentation.
Specify a default font for legend labels. For more detail see the Vega-Lite documentation.
Specify a default font size legend labels. For more detail see the Vega-Lite documentation.
Specify a default maximum width for legend labels in pixel units. For more detail see the Vega-Lite documentation.
Specify a default offset for legend labels. For more detail see the Vega-Lite documentation.
Specify whether or not time labels are abbreviated by default in a legend. For more detail see the Vega-Lite documentation.
Specify a default spacing between legend items. For more detail see the Vega-Lite documentation.
Specify a default legend symbol color. For more detail see the Vega-Lite documentation.
Specify a default legend symbol type. For more detail see the Vega-Lite documentation.
Specify a default legend symbol size. For more detail see the Vega-Lite documentation.
Specify a default legend symbol stroke width. For more detail see the Vega-Lite documentation.
Specify a default horizontal alignment for legend titles. For more detail see the Vega-Lite documentation.
Specify a default vertical alignment for legend titles. For more detail see the Vega-Lite documentation.
Specify a default color legend titles. For more detail see the Vega-Lite documentation.
Specify a default font for legend titles. For more detail see the Vega-Lite documentation.
Specify a default font size for legend titles. For more detail see the Vega-Lite documentation.
Specify a default font weight for legend titles. For more detail see the Vega-Lite documentation.
Specify a default maximum size in pixel units for legend titles. For more detail see the Vega-Lite documentation.
Specify a default spacing in pixel units between title and legend. For more detail see the Vega-Lite documentation.
Specify the default inner padding for x and y band-ordinal scales. For more details see the Vega-Lite scale config documentation
Specify the default outer padding for x and y band-ordinal scales. For more details see the Vega-Lite scale config documentation
Specify whether or not by default values that exceed the data domain are clamped to the min/max range value. For more details see the Vega-Lite scale config documentation
Specify the default maximum value for mapping quantitative fields to a bar's size/bandSize. For more details see the Vega-Lite scale config documentation
Specify the default minimum value for mapping quantitative fields to a bar's size/bandSize. For more details see the Vega-Lite scale config documentation
Specify the default maximum value for mapping a quantitative field to a text mark's size. For more details see the Vega-Lite scale config documentation
Specify the default minimum value for mapping a quantitative field to a text mark's size. For more details see the Vega-Lite scale config documentation
Specify the default maximum opacity (in the range [0, 1]) for mapping a field to opacity. For more details see the Vega-Lite scale config documentation
Specify the default minimum opacity (in the range [0, 1]) for mapping a field to opacity. For more details see the Vega-Lite scale config documentation
Specify the default maximum size for point-based scales. For more details see the Vega-Lite scale config documentation
Specify the default minimum size for point-based scales (when not forced to start at zero). For more details see the Vega-Lite scale config documentation
Specify the default maximum stroke width for rule, line and trail marks. For more details see the Vega-Lite scale config documentation
Specify the default minimum stroke width for rule, line and trail marks. For more details see the Vega-Lite scale config documentation
Specify the default padding for point-ordinal scales. For more details see the Vega-Lite scale config documentation
Specify the default range step for band and point scales when the mark is not text. For more details see the Vega-Lite scale config documentation
Specify whether or not by default numeric values are rounded to integers when scaling. Useful for snapping to the pixel grid. For more details see the Vega-Lite scale config documentation
Specify the default range step for x band and point scales of text marks. For more details see the Vega-Lite scale config documentation
Specify whether or not to use the source data range before aggregation. For more details see the Vega-Lite scale config documentation
Specify the default color scheme for categorical ranges. For details see the Vega-Lite documentation.
Specify the default diverging color scheme. For details see the Vega-Lite documentation.
Specify the default 'heatmap' color scheme. For details see the Vega-Lite documentation.
Specify the default ordinal color scheme. For details see the Vega-Lite documentation.
Specify the default ramp (contnuous) color scheme. For details see the Vega-Lite documentation.
Specify the default color scheme symbols. For details see the Vega-Lite documentation.
Specify the default anchor position when placing titles. For further details see the Vega-Lite title config documentation
Specify the default angle when orientating titles. For further details see the Vega-Lite title config documentation
Specify the default vertical alignment when placing titles. For further details see the Vega-Lite title config documentation
Specify the default color when showing titles. For further details see the Vega-Lite title config documentation
Specify the default font when showing titles. For further details see the Vega-Lite title config documentation
Specify the default font size when showing titles. For further details see the Vega-Lite title config documentation
Specify the default font weight when showing titles. For further details see the Vega-Lite title config documentation
Specify the default maximim length in pixel units when showing titles. For further details see the Vega-Lite title config documentation
Specify the default offset in pixel units of titles relative to the chart body. For further details see the Vega-Lite title config documentation
Specify the default placement of titles relative to the chart body. For further details see the Vega-Lite title config documentation
Specify the default width of single views (e.g. each view in a trellis plot). For further details see the Vega-Lite view config documentation
Specify the default height of single views (e.g. each view in a trellis plot). For further details see the Vega-Lite view config documentation
Specify whether or not by default single views should be clipped. For further details see the Vega-Lite view config documentation
Specify the default fill color for single views. For further details see the Vega-Lite view config documentation
Specify the default fill opacity for single views. For further details see the Vega-Lite view config documentation
Specify the default stroke color for single views. If Nothing is provided,
no strokes are drawn around the view. For further details see the
Vega-Lite view config documentation
Specify the default stroke opacity for single views. For further details see the Vega-Lite view config documentation
Specify the default stroke width of single views. For further details see the Vega-Lite view config documentation
Specify the default stroke dash style for single views. For further details see the Vega-Lite view config documentation
Specify the default stroke dash offset for single views. For further details see the Vega-Lite view config documentation
Indicates the anchor position for some text.
Indicates the style in which field names are displayed. The Verbal style is
'Sum of field', 'Year of date', 'field (binned)' etc. The Function style is
'SUM(field)', 'YEAR(date)', 'BIN(field)' etc. The Plain style is just the field
name without any additional text.
In addition to more general data types like integers and string, the following types can carry data used in specifications.
Specify a boolean data value. This is used when a function can accept values of different types.
Specify a date-time data value. This is used when a function can accept values of different types.
Specify a numeric data value. This is used when a function can accept values of different types.
Specify a string data value. This is used when a function can accept values of different types.
Specify a list of boolean data values. This is used when a function can accept lists of different types.
Specify a list of date-time data values. This is used when a function can accept lists of different types.
Specify a list of numeric data values. This is used when a function can accept lists of different types.
Specify a string data value. This is used when a function can accept values of different types.
Specify a year as an integer. For details, see the Vega-Lite dateTime documentation
Specify a year quarter as an integer. For details, see the Vega-Lite dateTime documentation
Specify a month as an integer (1=January, 2=February etc.). For details, see the Vega-Lite dateTime documentation
Specify a day of the month as an integer. For details, see the Vega-Lite dateTime documentation
Specify a day of the week. For details, see the Vega-Lite dateTime documentation
Specify an hour of the day (0=midnight, 1=1am, 23=11pm etc.) an integer. For details, see the Vega-Lite dateTime documentation
Specify a minute of an hour (0-59). For details, see the Vega-Lite dateTime documentation
Specify a second of a minute (0-59). For details, see the Vega-Lite dateTime documentation
Specify a millisecond of a second (0-999). For details, see the Vega-Lite dateTime documentation
Idntifies a month of the year.
Identifies the day of the week.
Describes a unit of time. Useful for encoding and transformations. See the Vega-Lite documentation for further details.
To encode a time as UTC (coordinated universal time, independent of local time
zones or daylight saving), provide a time unit to the utc function.
For example,
encoding
<< position X [ pName "date", pMType Temporal, pTimeUnit (utc YearMonthDateHours) ]Provides a UTC version of a given a time (coordinated universal time, independent of local time zones or daylight saving). For example,
encoding
<< position X [ pName "date", pMType Temporal, pTimeUnit (utc YearMonthDateHours) ]The following are deprecated and will be removed in a future major version release.
Generally, the constructors of each type should be replaced with a function of
a similar name. For example, instead of the Rule type use the rule function;
instead of PAggregate use pAggregate, instead of TmType use tMType etc.
Note: referencing position channel type constructors (PName, PBin etc.) is
deprecated in favour of calling their equivalent position channel functions
(pName, pBin etc.)
Position channel properties used for creating a position channel encoding.
Note: referencing mark channel type constructors (MName, MBin etc.) is
deprecated in favour of calling their equivalent mark channel functions
(mName, mBin etc.)
Mark channel properties used for creating a mark channel encoding.
Note: referencing detail channel type constructors (DName, DBin etc.)
is deprecated in favour of calling their equivalent detail channel functions
(dName, dBin etc.)
Level of detail channel properties used for creating a grouped channel encoding. For details see the Vega-Lite level of detail channel documentation
Note: facet channel type constructors (FName, FBin etc.) are
deprecated in favour of calling their equivalent facet channel functions
(fName, fBin etc.)
Types of facet channel property used for creating a composed facet view of small multiples.
Note: referencing hyperlink channel type constructors (HName, HBin etc.)
is deprecated in favour of calling their equivalent hyperlink channel functions
(hName, hBin etc.)
Types of hyperlink channel property used for linking marks or text to URLs.
Note: referencing order channel type constructors (OName, OBin etc.) is
deprecated in favour of calling their equivalent order channel functions
(oName, oBin etc.)
Properties of an ordering channel used for sorting data fields.
Note: referencing text channel type constructors (TName, TBin etc.) is
deprecated in favour of calling their equivalent text channel functions
(tName, tBin etc.)
Types of text channel property used for displaying text as part of the visualization.
Note: referencing mark type constructors (mark Area, mark Bar etc.) is
deprecated in favour of calling their equivalent mark functions (area, bar etc.)
Type of visual mark used to represent data in the visualization.
Deprecated: Use mark functions (e.g. circle, line) instead.
Create a mark specification. All marks must have a type (first parameter) and can optionally be customised with a list of mark properties such as interpolation style for lines.
Note: referencing mark property type constructors (MAlign, MFill etc.)
is deprecated in favour of calling their equivalent mark property functions
(maAlign, maFill etc.)
Properties for customising the appearance of a mark. For details see the Vega-Lite documentation.
Used for creating logical compositions. Note referencing BooleanOp type
constructors (And, Not, Expr etc.) is deprecated in favour of calling their
equivalent Boolean operation functions (and, not, expr etc.)
Deprecated in favour of channel-specific binning (e.g. pBin, oBin etc.)
Note: specifying binding elements with type constructors (IRange,
ICheckbox etc.) is deprecated in favour of calling their equivalent input binding
functions (iRange, iCheckbox etc.)
Describes the binding property of a selection based on some HTML input element such as a checkbox or radio button. For details see the Vega-Lite documentation and the Vega input binding documentation
Note: specifying axis properties with type constructors (AxDomain,
AxFormat etc.) is deprecated in favour of calling their equivalent property
specifying functions (axDomain, axFormat etc.)
Axis customisation properties. These are used for customising individual axes.
To configure all axes, use AxisConfig with a configuration instead. See the
Vega-Lite documentation
for more details.
Note: specifying axis configuration properties with type constructors (BandPosition,
Domain, Grid etc.) is deprecated in favour of calling their equivalent property
specifying functions (axcoBandPosition, axcoDomain, axcoGrid etc.)
Axis configuration options for customising all axes. See the Vega-Lite documentation for more details.
Note: specifying binning properties with type constructors (Base,
Extent etc.) is deprecated in favour of calling their equivalent property
specifying functions (biBase, biExtent etc.)
Type of binning property to customise. See the Vega-Lite documentation for more details.
Note: referencing configuration properties with type constructors (AreaStyle,
Autosize, Axis etc.) is deprecated in favour of calling their equivalent
configuration functions (coArea, coAutosize, coAxis etc.).
Type of configuration property to customise. See the Vega-Lite documentation for details.
Note: specifying input properties with type constructors (InMin,
InOptions etc.) is deprecated in favour of calling their equivalent property
specifying functions (inMin, inOptions etc.)
GUI Input properties. The type of relevant property will depend on the type of
input element selected. For example an InRange (slider) can have numeric min,
max and step values; InSelect (selector) has a list of selection label options.
For details see the
Vega input element binding documentation.
Note: referencing header property type constructors (HFormat and HTitle)
is deprecated in favour of calling their equivalent header property functions
(hdFormat, hdTitle etc.)
Represents a facet header property. For details, see the Vega-Lite documentation
Note: specifying legend configuration properties with type constructors
(CornerRadius, FillColor, LePadding etc.) is deprecated in favour of
calling their equivalent property specifying functions (lecoCornerRadius,
lecoFillColor, lecoPadding etc.)
Legend configuration options. For more detail see the Vega-Lite documentation.
Note: referencing legend property type constructors (LFormat, lTitleetc.)
is deprecated in favour of calling their equivalent legend property functions
(leFormat,leTitle` etc.)
Legend properties for customising a mark legend. For more detail see the Vega-Lite documentation.
Note: referencing legend value type constructors (LNumbers, LStrings
and LDateTimes) is deprecated in favour of calling their equivalent legend value
functions (leNums, leStrs and leDts)
A list of data values suitable for setting legend values.
Note: specifying projection properties with type constructors (PType,
PClipAngle etc.) is deprecated in favour of calling their equivalent
projection property functions (prType, prClipAngle etc.)
Properties for customising a geospatial projection that converts longitude/latitude pairs into planar (x,y) coordinate pairs for rendering and query. For details see the Vega-Lite documentation.
Note: specifying scale properties with type constructors (SDomain,
SRange etc.) is deprecated in favour of calling their equivalent property
specifying functions (scDomain, scRange etc.)
Individual scale property. These are used to customise an individual scale
transformation. To customise all scales use config and supply relevant
ScaleConfig values. For more details see the
Vega-Lite documentation
Note: specifying scale configuration properties with type constructors
(SCBandPaddingInner, SCClamp, etc.) is deprecated in favour of calling their
equivalent property specifying functions (socoBandPaddingInner,sacoClamp, etc.)
Scale configuration property. These are used to configure all scales. For more details see the Vega-Lite documentation
Note: specifying range configuration properties with type constructors
(RCategory, RDiverging, etc.) is deprecated in favour of calling their
equivalent property specifying functions (racoCategory,racoDiverging, etc.)
Properties for customising the colors of a range. The parameter should be a
named color scheme such as accent or purpleorange-11. For details see the
Vega-Lite documentation.
Note: specifying selection mark properties with type constructors (SMFill,
SMStroke etc.) is deprecated in favour of calling their equivalent functions
(smFill, smStroke etc.)
Properties for customising the appearance of an interval selection mark (dragged rectangle). For details see the Vega-Lite documentation.
Note: specifying title configuration properties with type constructors
(TAnchor, TAngle, etc.) is deprecated in favour of calling their
equivalent property specifying functions (ticoAnchor,ticoAngle, etc.)
Title configuration properties. These are used to configure the default style of all titles within a visualization. For further details see the Vega-Lite documentation
Note: specifying view configuration properties with type constructors
(Clip, ViewWidth, ViewHeight etc.) is deprecated in favour of calling their
equivalent property specifying functions (vicoClip,vicoWidth, vicoHeight etc.)
View configuration property. These are used to configure the style of a single view within a visualization such as its size and default fill and stroke colors. For further details see the Vega-Lite documentation
Note: referencing data types with type constructors (Boolean, DateTime,
Number and Str) is deprecated in favour of calling their equivalent data value
functions (boo, dt, num and str).
A single data value. This is used when a function can accept values of different types (e.g. either a number or a string).
Note: referencing lists of data types with type constructors (Booleans,
DateTimes, Numbers and Strings) is deprecated in favour of calling their
equivalent data value list functions (boos, dts, nums and strs).
A list of data values. This is used when a function can accept lists of different types (e.g. either a list of numbers or a list of strings).
Note: referencing dateTime type constructors (DTYear, DTHours etc.)
is deprecated in favour of calling their equivalent dateTime functions
(dtYear, dtHour etc.)
Allows a date or time to be represented. This is typically part of a list of
functions that each generate a DateTime item to provide a specific point in
time. For details see the
Vega-Lite documentation.
Note: referencing geometry type constructors (GeoPoint, GeoLine etc.)
is deprecated in favour of calling their equivalent geometry functions
(geoPoint, geoLine etc.)
Specifies the type and content of geometry specifications for programmatically
creating GeoShapes. These can be mapped to the
GeoJson geometry object types
where the pluralised type names refer to their Multi prefixed equivalent in the
GeoJSON specification.
Note: facet mapping type constructors (ColumnBy and RowBy ) are
deprecated in favour of calling their equivalent facet mapping functions
(columnBy and rowBy)
Provides details of the mapping between a row or column and its field definitions in a set of faceted small multiples. For details see the Vega-Lite documentation
Note: specifying repeat fields with type constructors (RowFields and
ColumnFields ) is deprecated in favour of calling their equivalent functions
(rowFields, columnFields)
Create a list of fields to use in set of repeated small multiples. The list of
fields named here can be referenced in an encoding with pRepeat Column, pRepeat Row
etc.
Note: referencing filter type constructors (FEqual, FExpr etc.)
is deprecated in favour of calling their equivalent filtering functions
(fiEqual, fiExpr etc.)
Type of filtering operation. See the Vega-Lite documentation for details.
Note: referencing filter range type constructors (NumberRange and DateRange)
is deprecated in favour of calling their equivalent filtering range functions
(numRange and dtRange.)
A pair of filter range data values. The first argument is the inclusive minimum vale to accept and the second the inclusive maximum.
Note: specifying resolve items with type constructors (RAxis,
RLegend and RScale) is deprecated in favour of calling their equivalent
resolve functions (reAxis, reLegend and reScale)
Used to determine how a channel's axis, scale or legend domains should be resolved if defined in more than one view in a composite visualization. See the Vega-Lite documentation for details.
Note: referencing padding type constructors (PSize and PEdges) is
deprecated in favour of calling their equivalent padding functions
(paSize and paEdges)
Represents padding dimensions in pixel units. PSize will set the same value
on all four edges of a rectangular container while PEdges can be used to specify
different sizes on each edge in order left, top, right, bottom.
Note: specifying scale ranges with type constructors (RNumbers,
RStrings and RName) is deprecated in favour of calling their equivalent
functions (raNums, raStrs and raName.)
Describes a scale range of scale output values. For details see the Vega-Lite documentation.
Convert a list of Vega-Lite specifications into a single JSON object that may be passed to Vega-Lite for graphics generation. Commonly these will include at least a data, mark and encoding specification.
While simple functions like
barmay be provided directly, it is usually clearer to label more complex ones such as encodings as separate expressions. This becomes increasingly helpful for visualizations that involve composition of layers, repeats and facets.Specifications can be built up by chaining a series of functions (such as
dataColumnorpositionin the example below). Functional composition using the<<operator allows this to be done compactly.