Create Vega-Lite visualization specifications in Elm. This package allows you to generate the JSON specs that may be passed to the Vega-Lite runtime library via a port to activate the visualization. Alternatively, to avoid coding the link to the Vega-Lite runtime, you can embed specifications directly in a litvis document.
Top-level Vega-Lite properties. These are the ones that define the core of the
visualization grammar. All VLProperties are created by functions in seven broad groups.
Data properties relate to the input data to be visualized. Generated by
dataFromColumns, dataFromRows,
dataFromUrl, dataFromSource,
dataFromJson, dataSequence, sphere
and graticule.
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
geoshape, point and line.
Mark functions specify the graphical 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, hyperlink and order.
Composition properties allow visualization views to be combined to form more
complex visualizations. Generated by layer, repeatFlow,
repeat, facetFlow, facet, concat,
columns, hConcat, vConcat,
specification and resolve.
Interaction properties allow clicking, dragging and other interactions generated
via a GUI or data stream to influence the visualization. Generated by
params with a paSelect parameter.
Supplementary and configuration properties provide a means to add metadata and
styling to one or more visualizations. Generated by name, title,
description, background, backgroundExpr,
width, height, widthStep, heightStep,
padding, autosize, viewBackground
and configure.
Part or all of a Vega-Lite specification. Specs are usually nested and can range from a single Boolean value up to the full visualization specification.
You only need to name something as a Spec when providing a top level function
with a type signature. For example,
myBarchart : Spec
myBarchart =
...A named Vega-Lite specification, usually generated by an elm-vega
function. You shouldn't need to create LabelledSpec tuples directly, but are
useful for type annotations.
Combine a list of labelled specifications to be passed to JavaScript for rendering. Useful when you wish to create a single page with multiple visualizations.
myCharts : Spec
myCharts =
combineSpecs
[ ( "vis1", myVis1 )
, ( "vis2", myVis2 )
, ( "vis3", myVis3 )
]To create a visualization, you will need to specify what data you wish to visualize. For context, see the Vega-Lite documentation.
Declare a data source from a url. The URL can be a local path such as a file name in the same folder as the elm specification or an external (CORS) URL. A list of field formatting instructions can be provided as the second parameter or an empty list to use the default formatting.
myPopData : Data
myPopData =
dataFromUrl "https://vega.github.io/vega-lite/data/population.json" []
myBikeData : Data
myBikeData =
dataFromUrl "./data/bicycleHires.csv"
[ parse
[ ( "numHires", foNum )
, ( "avHireTime", foNum )
]
]Declare a data source from a list of column values. Each column should contain values of the same type, but columns each with a different type are permitted. If columns do not contain the same number of items, the dataset will be truncated to the length of the shortest, so beware of inadvertently removing data rows at the 'bottom' of a table.
A list of field formatting instructions can be provided as the first parameter or an empty list to use the default formatting. Simple numbers and strings do not normally need formatting, but it is good practice to explicitly declare date-time formats because default date-time formats can vary between browsers.
The columns are most easily generated with dataColumn:
myChart : Spec
myChart =
let
data =
dataFromColumns [ parse [ ( "Year", foDate "%Y" ) ] ]
<< dataColumn "Animal" (strs [ "Fish", "Dog", "Cat" ])
<< dataColumn "Age" (nums [ 28, 12, 6 ])
<< dataColumn "Year" (strs [ "2015", "2019", "2020" ])
in
toVegaLite [ data [], ... ]For more complex inline data tables, such as mixtures of arrays and objects, consider using dataFromJson.
Create a column of data. A column has a name and a list of values which is
then added to an existing list of data columns. This allows multiple data column
specifications to be chained together with the << operator. For example, to represent
a table of data in this form:
| x | y |
| --- | --- |
| a | 1 |
| b | 2 |
| c | 3 |you could specify:
myChart : Spec
myChart =
let
data =
dataFromColumns []
<< dataColumn "x" (strs [ "a", "b", "c" ])
<< dataColumn "y" (nums [ 1, 2, 3 ])
in
toVegaLite [ data [], ... ]Declare a data source from a list of row values. Each row should contain a list of tuples in the form (column name, value). Each column can have a value of a different type but you must ensure that values are of the same type as others in the same column. A list of field formatting instructions can be provided as the first parameter or an empty list to use the default formatting. Rows are most easily generated with dataRow.
myChart : Spec
myChart =
let
data =
dataFromRows [ parse [ ( "Year", foDate "%Y" ) ] ]
<< dataRow [ ( "Animal", str "Fish" ), ( "Age", num 28 ), ( "Year", str "2015" ) ]
<< dataRow [ ( "Animal", str "Dog" ), ( "Age", num 12 ), ( "Year", str "2019" ) ]
<< dataRow [ ( "Animal", str "Cat" ), ( "Age", num 6 ), ( "Year", str "2020" ) ]
in
toVegaLite [ data [], ... ]Generally, adding data by column is more efficient and less error-prone, but occasionally there can be greater clarity in arranging data by rows. For more complex inline data tables, such as mixtures of arrays and objects, consider using dataFromJson.
Create a row of data. A row comprises a list of (columnName, value) pairs. For example, to specify this table:
| x | y |
| --- | --- |
| a | 1 |
| b | 2 |
| c | 3 |
myChart : Spec
myChart =
let
data =
dataFromRows []
<< dataRow [ ( "x", str "a" ), ( "y", num 1 ) ]
<< dataRow [ ( "x", str "b" ), ( "y", num 2 ) ]
<< dataRow [ ( "x", str "c" ), ( "y", num 3 ) ]
in
toVegaLite [ data [], ...]Declare a data source from a json specification. The most likely use-case is creating geojson objects with geometry, geometryCollection and geoFeatureCollection.
myChart : Spec
myChart =
let
geojson =
geometry (geoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
in
toVegaLite [ dataFromJson geojson [], geoshape [] ]For more general cases of json creation such as data tables that mix arrays and objects, consider combining with jsonToSpec. For example,
myChart : Spec
myChart =
let
data =
jsonToSpec """{
"Revenue" : [ 150, 225, 300 ],
"Profit" : [ 20, 25, 30 ],
"Order size" : [ 350, 500, 600 ],
"New customers" : [ 1400, 2000, 2500 ],
"Satisfaction" : [ 3.5, 4.25, 5 ]
}"""
|> dataFromJson
in
toVegaLite [ data [], ... ]Convert a string representing some JSON into a Spec. Useful when combined with dataFromJson to compactly import inline JSON as data. For example,
myChart : Spec
myChart =
let
data =
jsonToSpec """{
"Revenue" : [ 150, 225, 300 ],
"Profit" : [ 20, 25, 30 ],
"Order size" : [ 350, 500, 600 ],
"New customers" : [ 1400, 2000, 2500 ],
"Satisfaction" : [ 3.5, 4.25, 5 ]
}"""
|> dataFromJson
in
toVegaLite [ data [], ... ]This can also be used to store a full visualization specification from a JSON object. For example,
myChart : Spec
myChart =
"""
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": { "url": "https://cdn.jsdelivr.net/npm/[email protected]/data/cars.json"},
"mark": "bar",
"encoding": {
"x": { "field": "Origin" },
"y": { "field": "Miles_per_Gallon", "aggregate": "mean" }
}
}
""" |> jsonToSpecBut note this is not type-safe – if the JSON is not well-formed, a JSON null value is returned.
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.
myChart : Spec
myChart =
let
data =
dataFromColumns []
<< dataColumn "name" (strs [ "alphaville", "betatown" ])
<< dataColumn "pop" (nums [ 9350, 4770 ])
geoBounds =
geometry (geoPoints [ ( -4, 55 ), ( 3, 59 ) ]) []
|> dataFromJson
in
toVegaLite
[ datasets
[ ( "myData", data [] )
, ( "myJson", geoBounds [] )
]
, dataFromSource "myData" []
, ...
]Declare data from a named source. The source may be from named datasets within a specification or one created via the Vega View API. A list of field formatting instructions can be provided as the second parameter or an empty list to use the default formatting.
myChart : Spec
myChart =
let
data = ...
json = ...
in
toVegaLite
[ datasets [ ( "myData", data ), ( "myJson", dataFromJson json [] ) ]
, dataFromSource "myData" []
, ...
]Name to give a data source. Useful when a specification needs to reference a data source, such as one generated via an API call.
myChart : Spec
myChart =
let
data =
dataFromUrl "myData.json" []
|> dataName "myName"
in
toVegaLite [ data , ...]Ignore the data of a specification's parent when used in a composed spec such as layering or concatenation.
Type annotation for describing data generation functions. Useful when annotating top-level data-generating functions. For example,
myRegion : List DataColumn -> Data
myRegion =
dataFromColumns []
<< dataColumn "easting" (nums [ -3, 4, 4, -3, -3 ])
<< dataColumn "northing" (nums [ 52, 52, 45, 45, 52 ])Type annotation for a single column of data. Used when describing inline data with dataColumn.
Type annotation for a single row of data. Used when describing inline data with dataRow.
Specify a geometric object. The first parameter is the geometry type, the second an optional list of properties to be associated with the object.
myGeo : Data
myGeo =
(geometry (geoPoints [ ( -4, 55 ), ( 3, 59 ) ]) []
|> dataFromJson
)
[]A collection of geo features to be used in a geoshape specification. Each feature in this collection can be created with geometry.
myGeo : Data
myGeo =
(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" ) ]
]
|> dataFromJson
)
[]Collection of geometry objects that make up a single feature. Can be used in a geoshape specification. Each geometry object can be created with geometry.
myGeo : Data
myGeo =
(geometryCollection
[ geometry (geoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
, geometry (geoPoint -3.5 55.5) []
]
|> dataFromJson
)
[]Point geometry for programmatically creating GeoShapes. Equivalent to
the GeoJson geometry point type.
myGeo : Data
myGeo =
(geometry (geoPoint -3.5 55.5) []
|> dataFromJson
)
[]Multi-point geometry for programmatically creating GeoShapes. Equivalent
to the GeoJson geometry multi-point type.
myGeo : Data
myGeo =
(geometry (geoPoints [ ( -4, 55 ), ( -3, 59 ), ( -3, 56 ) ]) []
|> dataFromJson
)
[]Line geometry for programmatically creating GeoShapes. Equivalent to the
GeoJson geometry line type.
myGeo : Data
myGeo =
(geometry (geoLine [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ) ]) []
|> dataFromJson
)
[]Multi-line geometry for programmatically creating GeoShapes. Equivalent
to the GeoJson geometry multi-line type.
myGeo : Data
myGeo =
(geometry
(geoLines
[ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ) ]
, [ ( -4, 57 ), ( 2, 57 ), ( 2, 56 ) ]
]
)
[]
|> dataFromJson
)
[]Polygon geometry for programmatically creating GeoShapes. Equivalent
to the GeoJson geometry polygon type.
myGeo : Data
myGeo =
(geometry (geoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
|> dataFromJson
)
[]Multi-polygon geometry for programmatically creating GeoShapes. Equivalent
to the GeoJson geometry multi-polygon type.
myGeo : Data
myGeo =
(geometry
(geoPolygons
[ [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]
, [ [ ( -4, 57 ), ( 2, 57 ), ( 2, 56 ), ( -4, 57 ) ] ]
]
)
[]
|> dataFromJson
)
[]Functions that create new data sources.
Generate a sequence of numbers as a data source between the value of the first
parameter (inclusive) and the second (exclusive) in steps of the value of the third.
The resulting sequence will have the name data when referring to it within a
specification. For example,
sineWave : Spec
sineWave =
let
myData =
dataSequence 0 (2 * pi) (pi / 90)
trans =
transform
<< calculateAs "sin(datum.data)" "y"
enc =
encoding
<< position X [ pName "data", pQuant ]
<< position Y [ pName "y", pQuant ]
in
toVegaLite [ myData, trans [], enc [], line [] ]To give the sequence an alternative name use dataSequenceAs
Generate a sequence of numbers as a data source between the value of the first parameter (inclusive) and the second (exclusive) in steps of the value of the third. The resulting sequence will have the name provided as the fourth parameter.
myData : Data
myData =
dataSequenceAs 0 (2 * pi) (pi / 90) "x"Generate a data source that is a sphere for bounding global geographic data. The sphere will be subject to whatever projection is specified for the view.
myGlobe : Spec
myGlobe =
toVegaLite
[ sphere
, projection [ prType orthographic ]
, geoshape [ maFill "aliceblue" ]
]Generate a grid of lines of longitude (meridians) and latitude (parallels). The parameter can be used to specify the number and extent of lines, or to use default values, provide an empty list.
myGlobe : Spec
myGlobe =
let
proj =
projection [ prType orthographic ]
sphereSpec =
asSpec [ sphere, geoshape [ maFill "aliceblue" ] ]
gratSpec =
asSpec
[ graticule [ grStep ( 15, 15 ) ]
, geoshape [ maFilled False ]
]
in
toVegaLite [ proj, layer [ sphereSpec, gratSpec ] ]Set the step sizes between all graticule lines. The parameter is a (longitude,latitude) pair defining the EW and NS graticule intervals respectively.
Set the step sizes between major graticule lines. By default, major graticule lines extend to both poles, but minor lines stop at ±80 degrees latitude. The parameter is a (longitude,latitude) pair defining the EW and NS graticule intervals respectively.
Set the step sizes between minor graticule lines. While major graticule lines extend to both poles, by default minor lines stop at ±80 degrees latitude. The parameter is a (longitude,latitude) pair defining the EW and NS graticule intervals respectively.
Set the extent of both major and minor graticule lines. The first parameter is a (longitude,latitude) pair defining the minimum extent, the second parameter the maximum extent.
Set the extent of major graticule lines. The first parameter is a (longitude,latitude) pair defining the minimum extent, the second parameter the maximum extent.
Set the extent of minor graticule lines. The first parameter is a (longitude,latitude) pair defining the minimum extent, the second parameter the maximum extent.
The precision of the graticule in degrees. If unspecified, the default of 2.5 degrees is used. Smaller values provide a less stepped appearance of curved lines but take longer to render.
Specify parsing rules when processing some data text with dataFromUrl,
dataFromColumns etc. The parameter should be a list of tuples
in the form (fieldName, DataType). Useful when automatic type
inference needs to be overridden, for example to ensure numbers with - symbols
are treated as integers and not strings in transform calculations
or when converting integers representing years into dates. For example,
myData : Data
myData =
dataFromUrl "myDataFile.csv"
[ parse
[ ( "year", foDate "%Y" )
, ( "change", foNum )
]
]Specify a date/time format when parsing input data. Should use D3's formatting specifiers to describe the data-time format or an empty string for default formatting. Used by parse. For example,
myData : Data
myData =
dataFromUrl "myDataFile.csv"
[ parse [ ( "timestamp", foDate "%d %b %Y %H:%M" ) ] ]Specify a CSV (comma-separated values) file format when reading a data file. Only necessary if the file extension does not indicate the type. Used by dataFromUrl. For example,
myData : Data
myData =
dataFromUrl "myData" [ csv ]Specify a TSV (tab-separated values) file format when reading a data file. Only necessary if the file extension does not indicate the type. Used by dataFromUrl. For example,
myData : Data
myData =
dataFromUrl "myData" [ tsv ]Specify a custom delimited file format (DSV) with a given separator when reading a data file. Used by dataFromUrl. For example,
myData : Data
myData =
dataFromUrl "myData" [ dsv '|' ]Specify an Apache arrow data file format when reading a data file. Used by dataFromUrl. For example,
myData : Data
myData =
dataFromUrl "https://gicentre.github.io/data/scrabble.arrow" [ arrow ]A topoJSON feature format containing an object with the given name. The name
of the object can be found by inspecting the topoJSON file and searching for the
value associated with the objects key. Used by dataFromUrl.
For example,
myData : Data
myData =
dataFromUrl "https://gicentre.github.io/data/geoTutorials/londonBoroughs.json"
[ topojsonFeature "boroughs" ]A topoJSON mesh format containing an object with the given name. Unlike
topojsonFeature, the corresponding geo data are returned as a single unified mesh,
not as individual GeoJSON features. Generally meshes can be faster to render but
only suitable for showing boundary features, not filled areas. Used by dataFromUrl.
For example,
myLondon : Spec
myLondon =
toVegaLite
[ dataFromUrl "https://gicentre.github.io/data/geoTutorials/londonBoroughs.json"
[ topojsonMesh "boroughs" ]
, geoshape [ maFilled False ]
]Property to be extracted from some JSON when it has some surrounding structure.
e.g., specifying the property values.features is equivalent to retrieving
json.values.features from a JSON object with a custom delimiter. Used by dataFromJson.
Transformation rules are applied to data fields or geospatial coordinates before they are encoded visually. They are used when data need to be changed in some way, such as filtering items, calculating new fields, joining data tables or performing statistical analysis.
Create a single transform from a list of transformation specifications. The order of transformations can be important, e.g. labels created with calculateAs, timeUnitAs and binAs that 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"Create a map projection to transform geospatial coordinates. Only data positioned
with Longitude and Latitude or displayed as a geoshape
are affected by a projection.
myMap : Spec
myMap =
let
myData =
dataFromUrl "https://gicentre.github.io/data/geoTutorials/londonBoroughs.json"
[ topojsonFeature "boroughs" ]
proj =
projection
[ prType transverseMercator
, prRotate 2 0 0
]
in
toVegaLite [ myData, proj, geoshape [] ]Provide an expression to a map projection property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. Used by projection and coProjection. For example,
myMap : Spec
myMap =
let
geoData =
dataFromUrl "https://gicentre.github.io/data/geoTutorials/world-110m.json"
[ topojsonFeature "countries1" ]
ps =
params
<< param "zoom"
[ paValue (num 40)
, paBind (ipRange [ inMin 40, inMax 500 ])
]
proj =
projection [ prNumExpr "zoom" prScale ]
in
toVegaLite [ ps [], geoData, proj, geoshape [] ]Type of global map projection. Used by projection and coProjection. For example,
myProj =
projection [ prType orthographic ]An Albers equal-area conic map projection. Used by prType.
An azimuthal equal area map projection. Used by prType.
An azimuthal equidistant map projection. Used by prType.
A conformal (shape-preserving) conic map projection. Used by prType.
An equal area conic map projection. Used by prType.
An equidistant conic map projection. Distance is preserved along a standard parallel (or two parallels for secant projections). Used by prType.
An Equal Earth map projection that provides a reasonable shape approximation while retaining relative areas. Used by prType.
A gnomonic map projection. Used by prType.
An 'identity' projection where longitude is projected directly to the x position and latitude to the y position. Can also reflect either of the coordinates by specifying prReflectX / prReflectY in the list of projection properties. Used by prType.
A Mercator map projection. This is the default projection of longitude,latitude values if no projection is set explicitly. It preserves shape (local angle) and lines of equal angular bearing remain parallel straight lines. But area is significantly enlarged towards the poles. Used by prType.
A natural earth map projection. Used by prType.
An orthographic map projection. Used by prType.
A stereographic map projection. Used by prType.
A transverse Mercator map projection. Used by prType.
Specify a map projection type with an expression that evaluates to a valid projection name. Useful for interactive selection of map projection. Used by prType. For example,
myMap : Spec
myMap =
let
geoData =
dataFromUrl "https://gicentre.github.io/data/geoTutorials/world-110m.json"
[ topojsonFeature "countries1" ]
ps =
params
<< param "myProj"
[ paValue (str "EqualEarth")
, paBind
(ipSelect
[ inName "Map projection "
, inOptions
[ "EqualEarth"
, "Orthographic"
]
]
)
]
proj =
projection [ prType (prExpr "myProj") ]
in
toVegaLite [ ps [], geoData, proj, geoshape [] ]Projection’s clipping circle radius to the specified angle in degrees. A value of 0 will switch to antimeridian cutting rather than small-circle clipping. Used by projection and coProjection.
Projection’s viewport clip extent to the specified bounds in pixels. Used by projection and coProjection.
Indicate no clipping to be applied. Used by prClipExtent.
Specify the bounds in pixel coordinates of a clipped map projection in left, top, right, and bottom order. Used by prClipExtent. For example,
myMap : Spec
myMap =
let
geoData =
dataFromUrl "https://gicentre.github.io/data/geoTutorials/world-110m.json"
[ topojsonFeature "countries1" ]
proj =
projection
[ clipRect 0 0 600 270
|> prClipExtent
]
in
toVegaLite
[ width 600
, height 300
, geoData
, proj
, geoshape []
]Specify the bounds of a clipped map projection region with four expressions in left, top, right, and bottom order that evaluate to pixel positions. Useful when parameterising clip extent interactively. Used by prClipExtent. For example,
myMap : Spec
myMap =
let
geoData =
dataFromUrl "https://gicentre.github.io/data/geoTutorials/world-110m.json"
[ topojsonFeature "countries1" ]
ps =
params
<< param "left"
[ paValue (num 0)
, paBind (ipRange [ inMin 0, inMax 300 ])
]
<< param "right"
[ paValue (num 600)
, paBind (ipRange [ inMin 300, inMax 600 ])
]
<< param "top"
[ paValue (num 0)
, paBind (ipRange [ inMin 0, inMax 150 ])
]
<< param "bottom"
[ paValue (num 300)
, paBind (ipRange [ inMin 150, inMax 300 ])
]
proj =
projection
[ clipRectExpr "left" "top" "right" "bottom"
|> prClipExtent
]
in
toVegaLite
[ width 600
, height 300
, ps []
, geoData
, proj
, geoshape []
]Adjust map projection to fit the given geoShape within the display area. The geoShape can be a feature collection, a single feature or array of features. This is usually easier than adjusting a projection's prScale and prTranslate. Used by projection and coProjection. For example,
geoFrame =
geometry (geoPoints [ ( -8, 60 ), ( 1, 47 ) ])
[]
proj =
projection [ prFit geoFrame ]Projection’s center as longitude and latitude in degrees. Used by projection and coProjection.
Specify a projection’s centre with two expressions that should evaluate to a longitude and latitude respectively. Used by projection and coProjection.
A projection’s zoom scale, which if set, overrides automatic scaling of a geo feature to fit within the viewing area. Used by projection and coProjection.
A projection’s panning translation in pixel units, which if set, override automatic positioning of a geo feature to fit within the viewing area. Parameters should be provided in x y order. Used by projection and coProjection.
Specify a projection’s panning translation in pixel units, with two expressions that should evaluate to x and y translations respectively. Used by projection and coProjection.
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. Used by projection and coProjection.
Specify a projection’s three-axis rotation angle with three expressions that should evaluate to angular rotations (degrees) in lambda phi gamma order. Used by projection and coProjection.
Threshold for the projection’s adaptive resampling in pixels. Corresponds to the Douglas–Peucker distance. If precision is not specified, the projection’s current resampling precision of 0.707 is used. Used by projection and coProjection.
'Hammer' map projection coefficient. Used by projection and coProjection.
'Satellite' map projection distance. Used by projection and coProjection.
Bottomley map projection fraction. Used by projection and
coProjection.
Number of lobes in lobed map projections such as the 'Berghaus star'. Used by projection and coProjection.
Standard parallel for map projections such as the 'Armadillo'. Used by projection and coProjection.
A conic projection’s two standard parallels. Used by projection and coProjection.
Specify a conic projection’s two standard parallels with two expressions. Used by projection and coProjection.
Radius in pixels when drawing geo point features in a GeoFeature. Used by projection and coProjection.
Radius value for map projections such as the 'Gingery'. Used by projection and coProjection.
Ratio value for map projections such as the 'Hill'. Used by projection and coProjection.
Reflect the x-coordinates after performing an identity projection. This creates a left-right mirror image of the geoshape marks when subject to an identityProjection. Used by projection and coProjection.
Reflect the y-coordinates after performing an identity projection. This creates a top-bottom mirror image of the geoshape marks when subject to an identityProjection. Used by projection and coProjection.
Spacing value for map projections such as the 'Lagrange'. Used by projection and coProjection.
'Satellite' map projection tilt. Used by projection and coProjection.
See the Vega-Lite aggregate documentation.
Aggregation transformations to be used when encoding channels. Useful when for applying the same transformation to a number of channels without defining it each time. The first parameter is a list of the named aggregation operations to apply. The second is a list of 'group by' fields.
trans =
transform
<< aggregate
[ opAs opMin "people" "lowerBound", opAs opMax "people" "upperBound" ]
[ "age" ]Aggregation transformations to be used when encoding channels. Unlike aggregate, this transformation joins the results to the input data. Can be helpful for creating derived values that combine raw data with some aggregate measure, such as percentages of group totals. The first parameter is a list of the named aggregation operations to apply. The second is a list of possible window aggregate field properties, such as a field to group by when aggregating. The third parameter is a list of transformations to which this is added.
transform
<< joinAggregate [ opAs opMean "rating" "avYearRating" ]
[ wiGroupBy [ "year" ] ]
<< filter (fiExpr "(datum.rating - datum.avYearRating) > 3")For details, see the Vega-Lite join aggregate documentation
Aggregation operation. The first parameter is the 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.
trans =
transform
<< aggregate
[ opAs opMin "people" "lowerBound"
, opAs opMax "people" "upperBound"
]
[ "age" ]If the operation is opCount, it does not apply to any specific field, so the second parameter can be an empty string.
Create 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.
An input data object containing the minimum field value to be used in an
aggregation operation. If supplied as part of an encoding aggregation, the parameter
should be Just the name of the field to maximise. Used by mAggregate,
pAggregate, hAggregate, oAggregate,
tAggregate, dAggregate, fAggregate,
opAs, piOp, wiAggregateOp, soByField and
soByRepeat.
For example, the following would find the production budget for the maximum US grossing film in each genre:
encoding
<< position X
[ pName "Production_Budget"
, pQuant
, pAggregate (opArgMax (Just "US_Gross"))
]
<< position Y [ pName "Major_Genre", pNominal ]If supplied as part of a transform, the parameter should be Nothing as the field
is specified in the aggregate parameter.
trans =
transform
<< aggregate
[ opAs (opArgMax Nothing) "US_Gross" "amUSGross" ]
[ "Major_Genre" ]An input data object containing the minimum field value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Lower 95% confidence interval to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Upper 95% confidence interval to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Total count of data objects to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Count of distinct data objects to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Maximum field value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Mean value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Median field value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Minimum field value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Count of null or undefined field value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Product of field values to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Lower quartile boundary of field values to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Upper quartile boundary of field values to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Standard error of field values to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Sample standard deviation of field values to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Population standard deviation of field values to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Sum of field values to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Count of values that are not null, undefined or NaN to be used in an
aggregation operation. Used by
mAggregate, pAggregate, hAggregate,
oAggregate, tAggregate, dAggregate,
fAggregate, opAs, piOp, wiAggregateOp,
soByField and soByRepeat.
Sample variance of field value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
Population variance of field value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.
See the Vega-Lite binning documentation.
Binning transformation that may be referenced in other transformations or encodings. The first parameter is a list of customisation options (biBase, biDivide etc.) or an empty list to use the default binning. The second is the field to bin and the third the name to give the output binned data. Usually, direct binning within an encoding is preferred over this form of bin transformation.
trans =
transform
<< binAs [ biMaxBins 3 ] "IMDB_Rating" "ratingGroup"The name given to store the binned values (third parameter) will reference the start
of each bin value. To extract the end of each bin, use the same name but with _end
appended.
Set the desired range of bin values based on an interactive selection. The parameter should be the name of an interval selection parameter that defines the extent. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.
ps =
params
<< param "brush" [ paSelect seInterval [ seEncodings [ chX ] ] ]
enc =
encoding
<< position X
[ pName "temperature"
, pBin [ biSelectionExtent "brush" ]
]See the Vega-Lite stack documentation
Apply a stack transform for positioning multiple values. This is an alternative to specifying stacking directly when encoding position. First parameter is the field to be stacked; the second the fields to group by; the third and fourth are the names to give the output field names; the fifth lists the optional offset and sort properties.
Stack offset when applying a stack transformation.
Ordering within a stack when applying a stack transformation.
Indicate that the given field should be sorted in ascending order. Used by stSort.
Indicate that the given field should be sorted in descending order. Used by stSort.
Generate a new data field based on some calculations from existing values and fields. The first parameter is an expression representing the calculation and the second is the name to give the newly calculated field.
trans =
transform << calculateAs "datum.sex == 2 ? 'F' : 'M'" "gender"See the Vega-Lite filter documentation.
Apply a filter to a channel or field that specifies which values will 'pass through' for encoding. A filter can an expression such as,
trans =
transform << filter (fiExpr "datum.y < 50")noting that to refer to a particular data value, prefix the field name with datum..
Alternatively a boolean filtering function such as fiOneOf or
fiLessThan can be supplied,
trans =
transform << filter (fiLessThan "y" (num 50))Similar to fiSelection except that an empty selection filters out all values. Used by filter, fiOp and fiOpTrans.
Combine a data transformation operation with a filter before converting into a Boolean operation. This can be useful when working with dates. Used by prTest, fiCompose, axDataCondition, and, or and not. For example, the following will aggregate a set of dates into years and filter only those years between 2010 and 2017 inclusive:
filter
(fiRange "date" (dtRange [ dtYear 2010 ] [ dtYear 2017 ])
|> fiOpTrans (mTimeUnit year)
|> fiCompose
)Note the use of fiCompose to convert the Boolean operation back into a Filter.
Minimum-maximum number range to be used in data filtering. Used by fiRange.
Min max date-time range to be used in data filtering. If either parameter is an empty list, it is assumed to be unbounded. Used by fiRange.
Map array-valued fields to a set of individual data objects, one per array entry.
Similar to flatten but allows the new output fields to be named (second parameter).
Perform a gather operation to tidy a table. Collapse multiple data fields
into two new data fields: key containing the original data field names and value
containing the corresponding data values. This performs the same function as
'gather' in the Tidy Elm package
and the pivot_longer /
gather operation in the R
tidyverse . It is the inverse of pivot.
data =
dataFromColumns []
<< dataColumn "city" (strs [ "Bristol", "Sheffield", "Glasgow" ])
<< dataColumn "temp2017" (nums [ 12, 11, 7 ])
<< dataColumn "temp2018" (nums [ 14, 13, 10 ])
trans =
transform
<< fold [ "temp2017", "temp2018" ]
enc =
encoding
<< position X [ pName "key", pNominal ]
<< position Y [ pName "city", pNominal ]
<< size [ mName "value", mQuant ]Similar to fold but allows the new output key and value fields
to be given alternative names.
Perform a pivot operation on a table. Spreads a key-value pair of fields across multiple fields according to the data in the key field. The first two parameters are the key and value fields respectively. The third is a set of customisation options. This performs the same function as 'spread' in the Tidy Elm package and the pivot_wider / spread operation in the R tidyverse. It is the inverse of fold.
data =
dataFromColumns []
<< dataColumn "city" (strs [ "Bristol", "Bristol", "Sheffield", "Sheffield", "Glasgow", "Glasgow" ])
<< dataColumn "temperature" (nums [ 12, 14, 11, 13, 7, 10 ])
<< dataColumn "year" (nums [ 2017, 2018, 2017, 2018, 2017, 2018 ])
trans =
transform
<< pivot "year" "temperature" [ piGroupBy [ "city" ] ]
enc =
encoding
-- 2017 temperatures for the Bristol, Sheffield and Glasgow
<< position X [ pName "2017", pQuant ]
<< position Y [ pName "city", pNominal ]The data fields to group by when performing a pivot. If not specified, a single group containing all data objects will be used.
Maximum number of fields to generate performing a pivot. If 0 or unspecified, all fields are pivoted. The pivot names are sorted in ascending order before any limit is applied.
The aggregation to apply to grouped fields during a pivot.
Create lookups between data tables in order to join values from multiple sources. See the Vega-Lite lookup documentation.
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. 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.
For linking data with interactive selections, see lookupSelection.
A common use for lookup is to join geographic and attribute data sources. Below
geodata is the primary data source containing borough boundaries and censusData
the secondary data source containing attribute data. Both have common data field
values identifying a borough (id and borough) that is used to join the data sources:
geoData =
dataFromUrl "city.json" [ topojsonFeature "boroughs" ]
censusData =
dataFromUrl "census.csv" []
trans =
transform
<< lookup "id"
(censusData [])
"borough"
(luFields [ "carOwnership", "numBedrooms" ])Attach the results of an interactive selection to a primary data source. The first three parameters are the field in the primary data source to look up; the name of the interactive selection parameter; and the name of the field in the selection to link with the primary data field. This is similar to lookup except that the data in a selection are used in place of the secondary data source.
ps =
params
<< param "mySel"
[ paSelect sePoint [ seOn "mouseover", seEncodings [ chX ] ] ]
trans =
transform
<< lookupSelection "country" "mySel" "country"Names of the fields to be returned from a secondary data source when performing a lookup transformation.
The same as luFieldsAs except with a second parameter providing the default value if the lookup fails.
Name to give the entire set of fields in a secondary data source when performing
a lookup. To refer to individual fields via this name, use Javascript
dot notation (or if the field contains spaces, use equivalent array index notation
in single quotes such as o['my field']).
data =
dataFromUrl "data/flights-airport.csv" []
trans =
transform
<< lookup "origin"
(dataFromUrl "data/airports.csv" [])
"iata"
(luAs "o")
enc =
encoding
<< position Longitude [ pName "o.longitude", pQuant ]
<< position Latitude [ pName "o.latitude", pQuant ]Impute missing data. See the Vega-Lite impute documentation.
Impute missing data values as a data transform. The first parameter is the data field to process; the second the key field to uniquely identify data objects within a group; the third customisable options.
For example, to impute the missing value of b with the mean of existing b values,
when a is 30 and its color group (c) is 1:
let
data =
dataFromColumns []
<< dataColumn "a" (nums [ 0, 0, 10, 10, 20, 20, 30 ])
<< dataColumn "b" (nums [ 28, 91, 43, 55, 81, 53, 19 ])
<< dataColumn "c" (nums [ 0, 1, 0, 1, 0, 1, 0 ])
trans =
transform
<< impute "b" "a" [ imMethod imMean, imGroupBy [ "c" ] ]
enc =
encoding
<< position X [ pName "a", pQuant ]
<< position Y [ pName "b", pQuant ]
<< color [ mName "c", mNominal ]
in
toVegaLite [ data [], trans [], enc [], line [] ]1d window over which data imputation values are generated. The two
parameters should either be Just a number indicating the offset from the current
data object, or Nothing to indicate unbounded rows preceding or following the
current data object. Used by pImpute.
Key values to be considered for imputation. Used by pImpute.
Key values to be considered for imputation as a sequence of numbers between a start (first parameter), to less than an end (second parameter) in steps of the third parameter. Used by pImpute.
Imputation method to use when replacing values. Used by pImpute.
Allow imputing of missing values on a per-group basis. For use with the impute transform only and not a channel encoding. Used by pImpute.
See the Vega-Lite sample documentation
Randomly sample rows from a data source up to a given maximum. For example, to randomly sample 50 values from a sine curve:
data =
dataSequenceAs 0 13 0.001 "x"
trans =
transform
<< calculateAs "sin(datum.x)" "y"
<< sample 50See the Vega-Lite density documentation
Apply Kernel Density Estimation to a data stream to generate a new stream of samples of the estimated density. Useful for representing probability distributions and generating continuous distributions from discrete samples.
The data fields to group by when estimating density. If not specified, a single group containing all data objects will be used.
Whether or not density estimates will be cumulative. If unspecified, non-cumulative estimates will be generated.
Whether density estimates should generate counts (true) or probabilities (false). If unspecified, probabilities will be generated.
The bandwidth (standard deviation) of the Gaussian kernel used in KDE estimation. If 0 or unspecified, the bandwidth will be calculated using Scott's method. Used by density.
The min (first parameter) - max (second parameter) domain from which to sample a distribution for density estimation. If unspecified, the full extent of input values will be sampled.
The minimum number of samples to take from the extent domain when estimating density. Default is 25.
The maximum number of samples to take when estimating density. Default is 200.
The exact number of samples to take from the extent domain when estimating density. Will override dnMinSteps and dnMaxSteps and is useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.
Name the outputs of the density transform. The first parameter is the name to
give the field containing samples, the second the name to give the field containing
density estimates. If not specified, the default names value and density will
be used.
See the Vega-Lite loess documentation
Generate a loess (locally-estimated scatterplot smoothing) trendline through a pair of data fields. The first parameter is the name of the field representing the dependent variable (commonly mapped to the y-axis), the second is the name of the field representing the independent variable (commonly mapped to the x-axis). The third parameter is a list of optional loess parameters to customise the trend fitting.
The data fields to group by when generating a loess trendline. If not specified, a single group containing all data objects will be used.
The bandwidth scaled between [0,1] to determine the amount of loess smoothing. Default value is 0.3
Name the outputs of a loess transform. The first parameter is the name to give the field containing the smoothed independent variable, the second the name to give the field containing smoothed dependent variable. If not specified, the original input independent and dependent field names are used.
Generate a 2d regression model for smoothing and predicting data. The first parameter is the name of the field representing the dependent variable (commonly mapped to the y-axis), the second is the name of the field representing the independent variable (commonly mapped to the x-axis). The third parameter is a list of optional regression customisation options.
The data fields to group by when generating a regression model. If not specified, a single group containing all data objects will be used.
The type of regression model to use when generating a 2d regression. Used by rgMethod.
The order of a polynomial model to use when generating a 2d regression. Only applies if rgMethod is set to rgPoly.
The min (first parameter) - max (second parameter) domain over which to estimate the dependent variable in a regression. If unspecified, the full extent of input values will be used.
Whether or not the regression transform should return just the parameters
of the regression function (one object per group) instead of trend line points. If True,
objects include a coef array of fitted coefficient values, starting with the intercept term
and then terms of increasing order and an rSquared value, indicating the total variance
explained by the model.
Name the outputs of a regression transform. The first parameter is the name to give the field containing the independent variable, the second the name to give the field containing dependent variable. If not specified, the original input independent and dependent field names are used.
Indicate a linear regression method. Used by rgMethod.
Indicate a log regression method. Used by rgMethod.
Indicate an exponential regression method. Used by rgMethod.
Indicate a power regression method. Used by rgMethod.
Indicate a quadratic regression method. Used by rgMethod.
Calculate quantile values from an input data stream. Useful for examining distributional properties of a data stream and for creating Q-Q plots.
The data fields to group by when performing a quantile transformation. If not specified, a single group containing all data objects will be used.
The field names to give the probability and associated quantile values generated
by a quantile transformation. If not specified, prob and value are used.
See the Vega-Lite window transform field and window transform documentation.
Window transform for performing calculations over sorted groups of data objects such as ranking, lead/lag analysis, running sums and averages.
The first parameter is a list of tuples each comprising a window transform field definition and an output name. The second is the window transform definition.
trans =
transform
<< window [ ( [ wiAggregateOp opSum, wiField "Time" ], "TotalTime" ) ]
[ wiFrame Nothing Nothing ]An aggregate operation to be used in a window transformation. For example,
transform
<< window [ ( [ wiAggregateOp opSum, wiField "Time" ], "TotalTime" ) ]
[ wiFrame Nothing Nothing ]Window-specific operation to be used in a window transformation.
Numeric parameter for window-only operations that can be parameterised (woPercentile, woLag, woLead and woNthValue).
Field for which to compute a window operation. Not needed for operations that do not apply to fields such as opCount, woRank and woDenseRank.
Assign consecutive row number to values in a data object to be applied in a window transform. Used by wiOp.
Rank opertation to be applied in a window transform. Used by wiOp.
Dense rank operation to be applied in a window transform. Used by wiOp.
Percentile of values in a sliding window be applied in a window transform. Used by wiOp.
Cumulative distribution operation to be applied in a window transformation. Used by wiOp.
Value preceding the current object in a sliding window to be applied in a window transform. Used by wiOp.
Value preceding the current object in a sliding window to be applied in a window transform. Used by wiOp.
Value following the current object in a sliding window to be applied in a window transform. Used by wiOp.
First value in a sliding window to be applied in a window transform. Used by wiOp.
Last value in a sliding window to be applied in a window transform. Used by wiOp.
Nth value in a sliding window to be applied in a window transform. Used by wiOp.
Whether or not the sliding window frame in a window transform should ignore peer values (those considered identical by the sort criteria).
Fields for partitioning data objects in a window transform into separate windows. If unspecified, all points will be in a single group.
Comparator for sorting data objects within a window transform.
Indicate that the given field should be sorted in ascending order when performing a window transform. Used by wiSort.
Indicate that the given field should be sorted in descending order when performing a window transform. Used by wiSort.
Functions for declaring the type of visual marks used to represent encoded data.
Arc mark for radial plots such as pie charts or rose diagrams.
An area mark for representing a series of data elements, such as in a stacked area chart or streamgraph.
Bar mark for histograms, bar charts etc.
Boxplot composite mark for showing summaries of statistical distributions. By default, just box and whiskers are shown, but ticks and outliers can be specified explicitly.
boxplot
[ maTicks [ maColor "black", maSize 8 ]
, maBox [ maFill "grey" ]
, maOutliers [ maColor "firebrick" ]
]Errorband composite mark for showing summaries of variation along a signal. By default no border is drawn. To add a border use maBorders with an empty list for default border, or mark properties to customise.
errorband [ maBorders [ maColor "black", maStrokeWidth 0.5 ] ]Errorbar composite mark for showing summaries of variation along a signal. By default no ticks are drawn. To add ticks with use maTicks with an empty list for default appearance, or with a list of mark properties to customise.
errorbar [ maTicks [ maColor "black", maSize 8 ] ]Circle mark for symbolising points. Unlike the point mark, circles are filled by default and may be sized via a separate size encoding.
Display a geoshape determined by geographically referenced coordinates.
myMap : Spec
myMap =
let
myData =
dataFromUrl "https://gicentre.github.io/data/geoTutorials/londonBoroughs.json"
[ topojsonFeature "boroughs" ]
proj =
projection
[ prType transverseMercator
, prRotate 2 0 0
]
in
toVegaLite
[ myData
, proj
, geoshape
[ maFill "lightgrey"
, maStroke "white"
]
]Image mark for displaying an image. The parameter is a list of standard mark properties for customising the image. The image files to be displayed should be specified via the url channel. Normally, the width and height of the image should be specified with maWidth and maHeight.
let
data =
dataFromColumns []
<< dataColumn "x" (nums [ 0.5, 1.5, 2.5 ])
<< dataColumn "y" (nums [ 0.5, 1.5, 2.5 ])
enc =
encoding
<< position X [ pName "x", pQuant ]
<< position Y [ pName "y", pQuant ]
<< url [ hStr "myImage.png" ]
in
toVegaLite [ data [], enc [], image [ maWidth 50, maHeight 25 ] ]Alternatively, data-driven images can be used by referencing a data field containing image URLs.
let
data =
dataFromColumns []
<< dataColumn "x" (nums [ 0.5, 1.5, 2.5 ])
<< dataColumn "y" (nums [ 0.5, 1.5, 2.5 ])
<< dataColumn "img" (strs [ "img1.png", "img2.png", "img3.png" ])
enc =
encoding
<< position X [ pName "x", pQuant ]
<< position Y [ pName "y", pQuant ]
<< url [ hName "img", hNominal ]
in
toVegaLite [ data [], enc [], image [ maWidth 30, maHeight 30 ] ]Line mark for symbolising a sequence of values.
Point mark for symbolising a data point with a symbol.
Rule line connecting two vertices.
Square mark for symbolising points.
Text mark to be displayed at some point location.
Short line (tick) mark for symbolising point locations.
Trail mark (line with variable width along its length).
See the Vega-Lite general mark, area mark, bar mark, boxplot, circle mark, error band, error bar, hyperlink mark, image mark, line mark, point mark, rect mark, rule mark, square mark, text mark and tick mark property documentation.
Provide an expression to a mark property function requiring a boolean value. This can be used to provide an interactive parameterisation of a mark property by providing an expression bound to an input element. For example,
ps =
params
<< param "asp"
[ paValue (boo True)
, paBind (ipCheckbox [ inName "maintain aspect ratio" ])
]
mk =
image [ maBooExpr "asp" maAspect ]Provide an expression to a mark property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. For example,
ps =
params
<< param "r"
[ paValue (num 0)
, paBind (ipRange [ inMax 100 ])
]
mk =
arc [ maNumExpr "r" maInnerRadius ]Provide an expression to a mark property function requiring a list of numbers (for dash styles). This can be used to provide an interactive parameterisation of a mark's dash property when an expression is bound to an input element. For example,
ps =
params
<< param "dashStyle"
[ paValue (nums [ 2, 2 ])
, paBind (ipSelect [ inDataOptions [ nums [ 2, 2 ], nums [ 8, 8 ] ] ])
]
mk =
bar
[ maNumsExpr "dashStyle" maStrokeDash, maStroke "black" ]Provide an expression to a mark property function requiring a string value. This can be used to provide an interactive parameterisation of a mark property by providing an expression bound to an input element. For example,
ps =
params
<< param "clr"
[ paValue (str "red")
, paBind (ipColor [])
]
mk =
circle [ maStrExpr "clr" maFill ]Horizontal alignment of a textMark.
Rotation angle of a textMark (degrees from horizontal).
Band size of a bar mark.
Vertical alignment of a textMark.
Offset between bars for a binned field using a bar mark.
Color blend mode for drawing a mark such as bar or circle over its current background. Standard CSS blend modes can be specified such as bmHue, bmDarken etc.
Border properties for an errorband mark.
Box symbol properties for the boxplot mark. If an empty list is provided, no box will be shown.
Default color of a mark. Note that maFill and maStroke have higher
precedence and will override this if specified. Used by mark functions such
as bar and line.
Color strings can use any valid HTML color specification.
maColor "#eee"
maColor "#734FD8"
maColor "crimson"
maColor "rgb(255,204,210)"
maColor "hsl(180, 50%, 50%)"A color gradient to apply to a mark such as bar or circle. The first parameter indicates whether the gradient should be linear or radial. The second is a set of customisation options for the colors, positioning and rate of change of the gradient. For example, to set a radial red-blue color gradient for a mark:
maColorGradient grRadial [ grStops [ ( 0, "red" ), ( 1, "blue" ) ] ]The radius in pixels of the 'end' corners of a bar mark. For vertical bars this would be the top corners and for horizontal bars, the right corners.
The radius in pixels of the top-left corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.
The radius in pixels of the top-right corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.
The radius in pixels of the bottom-left corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.
The radius in pixels of the bottom-right corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.
Cursor to be associated with a hyperlink mark.
Hyperlink to be associated with a mark such as a circle making it a clickable hyperlink.
Continuous band size of a bar mark.
Discrete band size of a bar mark.
Width in pixels indicating maximum permitted space for a [textMark](#textMark Any mark that exceeds this limit will be truncated with an ellipsis.
Direction of text in a textMark, which determines which end is truncated in cases where text is larger than available space.
Text to indicate a truncated piece of a textMark. Default is the ellipsis ...
Horizontal offset between a textMark and its anchor.
Vertical offset between a textMark mark and its anchor.
Fix the inner radius (R2) of a radial plot using an arc mark. Can be used for creating 'holes' in pie chart.
Fix the outer radius (R) of a radial plot using an arc mark.
Angular padding applied to sides of an arc mark (in radians).
Default fill color of a mark such as bar or circle. Color strings can use any valid HTML color specification.
maFill "#eee"
maFill "#734FD8"
maFill "crimson"
maFill "rgb(255,204,210)"
maFill "rgba(255,50,80,0.3)"
maFill "hsl(180, 50%, 50%)"Usually, to avoid filling the interior of a mark, use maFilled False,
but maFill "" can instead be used for cases where an interactive tooltip needs
to 'see through' a stroked mark to one underneath it in a layered specification.
A color gradient to apply to a mark's interior. The first parameter indicates whether the gradient should be linear or radial. The second is a set of customisation options for the colors, positioning and rate of change of the gradient. For example, to set a radial red-blue color gradient as a fill for a mark:
maStrokeGradient grRadial [ grStops [ ( 0, "red" ), ( 1, "blue" ) ] ]Fill gradients have a higher priority than maColorGradient. Used by mark functions such as bar and circle.
Font of a textMark. Can be any font name made accessible via a css file (or
a generic font like serif, monospace etc.).
Font size in pixels used by a textMark.
Font style (e.g. italic) used by a textMark.
Font weight used by a textMark.
Appearance of a line marker joining the vertices of an area mark. For example,
area
[ maLine (lmMarker [ maStroke "black" ])
, maInterpolate miMonotone
]Median line properties for the boxplot mark. If an empty list is provided, no median line will be shown.
Outlier symbol properties for the boxplot mark. If an empty list is provided, no outliers will be shown.
Radial offset of a textMark from an origin specified in Cartesian
X and Y coordinates.
Rule (main line) properties for the errorbar and boxplot marks. If an empty list is provided, no rule will be shown.
Shape of a point mark.
Whether or not month and weekday names are abbreviated in a textMark.
A color gradient to apply to a mark's boundary stroke. The first parameter indicates whether the gradient should be linear or radial. The second is a set of customisation options for the colors, positioning and rate of change of the gradient. For example, to set a radial red-blue color gradient for a mark's stroke:
maStrokeGradient grRadial [ grStops [ ( 0, "red" ), ( 1, "blue" ) ] ]Stroke gradients have a higher priority than maColorGradient.
Rounded stroke cap. Used by maStrokeCap, axDomainCap, axcoDomainCap, axTickCap, axcoTickCap, axGridCap, axcoGridCap, viewStrokeCap and vicoStrokeCap.
Square stroke cap. Used by maStrokeCap, axDomainCap, axcoDomainCap, axTickCap, axcoTickCap, axGridCap, axcoGridCap, viewStrokeCap and vicoStrokeCap.
Butt stroke cap. Used by maStrokeCap, axDomainCap, axcoDomainCap, axTickCap, axcoTickCap, axGridCap, axcoGridCap, viewStrokeCap and vicoStrokeCap.
Expression that evaluates to some stroke cap style such as "square", "butt" or "round". Used by maStrokeCap, axDomainCap, axcoDomainCap, axTickCap, axcoTickCap, axGridCap, axcoGridCap, viewStrokeCap and vicoStrokeCap.
Number of pixels before the first line dash is drawn in a mark such as line.
Rounded stroke join. Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.
Bevelled stroke join. Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.
Mitred stroke join. Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.
Expression that evaluates to some stroke join style such as "bevel", "miter" or "round". Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.
Names of custom styles to apply to a mark such as bar or area. Each should refer to a named style defined in a separate style configuration with coMarkStyles. While this is provided for compatibility with Vega-Lite style specification, for greater type safety in elm-vegalite, instead create functions that generate MarkProperties.
Placeholder text for a textMark for when a text channel is not specified.
Multi-line text can be specified by adding a \n at each line break or by using
a """ multi-line string.
Line height for a multi-line textMark.
Polar coordinate angle (clockwise from north in radians) of the end of an arc mark.
Thickness of a tick mark.
Provide source of a mark's tooltip content. For example to show all encoded data values in the tooltip of a circle mark:
circle [ maTooltip ttEncoding ]An image mark's URL.
Explicitly set the width of a mark such as a bar.
Set the width of a mark as a proportion of its band size. For example, to set a bar width to be three quarters of its normal width,
bar [ maWidthBand 0.75 ]Explicitly set the height of a mark such as rect.
Set the height of a bar mark as a proportion of its band size.
Y position of a mark such as rect or [rule][#rule].
X position offset for a mark such as textMark.
Y position offset for a mark such as textMark.
Clockwise angular offset (in radians) of a radially positioned mark such as an arc.
Clockwise angular offset (in radians) of the second theta value of a radially positioned mark such as an arc. Useful when the offsets to apply to the start and end angle of an arc need to be set independently.
X2 position offset for a mark such as rect or [rule][#rule].
Y2 position offset for a mark.
Polar coordinate inner radial offset of an arc mark from a polar origin
specified with Theta, R and R2.
Whether or not the aspect ratio of an image mark should be preserved.
Indicate a linear color gradient. See the Vega-Lite color gradient documentation. Used by maColorGradient, maFillGradient and maStrokeGradient.
Indicate a radial color gradient. See the Vega-Lite color gradient documentation. Used by maColorGradient, maFillGradient and maStrokeGradient.
The x-coordinate, normalised to [0, 1], for the start of a color gradient. If the gradient is linear the default is 0; if radial, it is the x-position of the centre of the inner circle with a default of 0.5. Used by maColorGradient, maFillGradient and maStrokeGradient.
The x-coordinate, normalised to [0, 1], for the end of a color gradient. If the gradient is linear the default is 1; if radial, it is the x-position of the centre of the outer circle with a default of 0.5. Used by maColorGradient, maFillGradient and maStrokeGradient.
The y-coordinate, normalised to [0, 1], for the start of a color gradient. If the gradient is linear the default is 0; if radial, it is the y-position of the centre of the inner circle with a default of 0.5. Used by maColorGradient, maFillGradient and maStrokeGradient.
The y-coordinate, normalised to [0, 1], for the end of a color gradient. If the gradient is linear the default is 1; if radial, it is the y-position of the centre of the outer circle with a default of 0.5. Used by maColorGradient, maFillGradient and maStrokeGradient.
The radius, normalised to [0, 1], of the inner circle for a radial color gradient. Default is 0. Used by maColorGradient, maFillGradient and maStrokeGradient.
The radius, normalised to [0, 1], of the outer circle for a radial color gradient. Default is 0.5. Used by maColorGradient, maFillGradient and maStrokeGradient.
Color interpolation points. Each tuple in the list is a position normalised [0, 1] and its associated color. Used by maColorGradient, maFillGradient and maStrokeGradient.
Indicate horizontal mark orientation. Used by maOrient, leDirection, lecoDirection, lecoGradientDirection and lecoSymbolDirection.
Indicate vertical mark orientation. Used by maOrient, leDirection, lecoDirection, lecoGradientDirection and lecoSymbolDirection.
Cubic basis spline interpolation between points anchored at first and last points. Used by maInterpolate.
Open cubic basis spline interpolation between points, which may not intersect first and last points. Used by maInterpolate.
Closed cubic basis spline interpolation between points forming a polygon. Used by maInterpolate.
Bundle curve interpolation between points.
Cubic cardinal spline interpolation between points anchored at first and last points. Used by maInterpolate.
Open cubic cardinal spline interpolation between points, which may not intersect first and last points. Used by maInterpolate.
Closed cubic cardinal spline interpolation between points forming a polygon. Used by maInterpolate.
Linear (straight) interpolation between points. Used by maInterpolate.
Linear (straight) interpolation between points that joins the first and last points in a sequence to form a closed polygon. Used by maInterpolate.
Cubic spline interpolation that preserves monotonicity between points. Used by maInterpolate.
Piecewise (stepped) constant interpolation function centred on each point in a sequence. Used by maInterpolate.
Piecewise (stepped) constant interpolation function after each point in a sequence. Used by maInterpolate.
Piecewise (stepped) constant interpolation function before each point in a sequence. Used by maInterpolate.
Expression that evaluates to some interpolation method such as "linear", "basis" or "monotone". Used by maInterpolate.
Indicate a left-to-right text direction.
Indicate a right-to-left text direction.
Expression that evaluates to a text direction "ltr" (left-to-right) or 'rtl' (right-to-left) .
Specify a circular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a cross symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a diamond symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a square symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify an upward triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a downward triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a leftward facing triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a rightward facing triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
A custom symbol shape as an SVG path description. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a linear symbol for a shape mark. Note that this will only be visible if the symbol has a stroke setting (unlike all the other areal symbols filling it has no effect). Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a centred arrow symbol for a shape mark. Useful for vector plots. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a centred wedge (thin triangle) symbol for a shape mark. Useful for vector plots. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Specify a centred triangle symbol for a shape mark. Useful for vector plots. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
Expression that evaluates to some symbol such as "diamond", "cross" or "circle". Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.
No point marker to be shown on a line or area mark. Used by maPoint.
Transparent point marker to be placed on area or line mark. Useful for interactive selections. Used by maPoint.
Properties of a point marker that is overlaid on a line or area mark. Used when specifying an maPoint.
Properties of a line marker that is overlaid on an area mark. Used when specifying an maLine.
Indicate no line marker on an area mark. Used when specifying an maLine.
Band extent between the minimum and maximum values in a distribution. Used by maExtent.
Band extent between the 95% confidence intervals of a distribution. Used by maExtent.
Band extent between the lower and upper quartiles of a distribution. Used by maExtent.
A scaling of the interquartile range to be used as whiskers in a boxplot. For example, a value of 1.5 would extend whiskers to ±1.5x the IQR from the mean. Used by maExtent.
Band extent as the standard error about the mean of a distribution. Used by maExtent.
Band extent as the standard deviation of a distribution. Used by maExtent.
Indicate tooltips are generated by all fields in the underlying data. Used by maTooltip. For example,
circle [ maTooltip ttData ]Indicate tooltips should be enabled using the encoded data of the mark. Used by maTooltip. For example,
circle [ maTooltip ttEncoding ]Indicate that tooltips should be disabled for the mark (default). Used by maTooltip. For example,
circle [ maTooltip ttNone ]Indicate the default blend mode should be applied when drawing over some background. Used by maBlend.
Multiplicative blend mode to be applied when drawing over some background. Used by maBlend.
Screen blend mode to be applied when drawing over some background. Used by maBlend.
Overlay blend mode to be applied when drawing over some background. Used by maBlend.
Lighten blend mode to be applied when drawing over some background. Used by maBlend.
Color dodge blend mode to be applied when drawing over some background.
Color burn blend mode to be applied when drawing over some background.
Hard light blend mode to be applied when drawing over some background. Used by maBlend.
Soft light blend mode to be applied when drawing over some background. Used by maBlend.
Difference blend mode to be applied when drawing over some background. Used by maBlend.
Exclusion blend mode to be applied when drawing over some background. Used by maBlend.
Saturation blend mode to be applied when drawing over some background. Used by maBlend.
Luminosity blend mode to be applied when drawing over some background. Used by maBlend.
Expression that evaluates to some blend mode such as "darken", "hue" or "luminosity". Used by maBlend.
See the CSS cursor documentation
Automatically determine a cursor type depending on interaction context. Used by maCursor, smCursor and vicoCursor.
Default cursor. Used by maCursor, smCursor and vicoCursor.
No cursor. Used by maCursor, smCursor and vicoCursor.
Context menu cursor. Used by maCursor, smCursor and vicoCursor.
Help cursor. Used by maCursor, smCursor and vicoCursor.
Pointer cursor. Used by maCursor, smCursor and vicoCursor.
Progress cursor. Used by maCursor, smCursor and vicoCursor.
Waiting cursor. Used by maCursor, smCursor and vicoCursor.
Cell cursor. Used by maCursor, smCursor and vicoCursor.
Crosshair cursor. Used by maCursor, smCursor and vicoCursor.
Text cursor. Used by maCursor, smCursor and vicoCursor.
Vertical text cursor. Used by maCursor, smCursor and vicoCursor.
Alias cursor. Used by maCursor, smCursor and vicoCursor.
Copy cursor. Used by maCursor, smCursor and vicoCursor.
Move cursor. Used by maCursor, smCursor and vicoCursor.
'No drop' cursor. Used by maCursor, smCursor and vicoCursor.
'Not allowed' cursor. Used by maCursor, smCursor and vicoCursor.
Scrolling cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Resizing cursor. Used by maCursor, smCursor and vicoCursor.
Zooming cursor. Used by maCursor, smCursor and vicoCursor.
Zooming cursor. Used by maCursor, smCursor and vicoCursor.
Grab cursor. Used by maCursor, smCursor and vicoCursor.
Grabbing cursor. Used by maCursor, smCursor and vicoCursor.
Expression that evaluates to some cursor style such as "crosshair", "grab" or "help". Used by maCursor, smCursor and vicoCursor.
Describes the mapping between data fields and the channels (position, color etc.) used to determine the visual appearance of marks that represent them.
Create an encoding specification from a list of channel encodings. These are commonly built by chaining series of channel encoding functions together such as position, color, size etc.
enc =
encoding
<< position X [ pName "month", pTemporal ]
<< position Y [ pName "score", pQuant ]
<< color [ mName "team" ]Type of measurement to be associated with some channel.
Nominal indicates categories that have no order. e.g. people's names; country names.Ordinal indicates ordered categories. e.g. Small / Medium / Large; 1st, 2nd, 3rd.Quantitative indicates numerical measurements and counts. e.g. price; temperature; frequency.Temporal indicates time-related data.GeoFeature indicates one or more geographic locations. e.g. a longitude/latitude; country outline.Relates to where something appears in the visualization. See the Vega-Lite position documentation
Encode a position channel. The first parameter identifies the channel, the second a list of position encoding options.
enc =
encoding
<< position X [ pName "month", pTemporal ]
<< position Y [ pName "numHires", pQuant ]Type of position channel. X and Y position marks along the horizontal and
vertical axes. X2 and Y2 are used in combination with X and Y when two
boundaries of a mark need to be specified (e.g. a rule mark). XOffset
and YOffset can additional shift position in response to some field, for example
to create a grouped bar chart or jitter-plot.
Theta positions an arc mark's angular offset allowing, for example, pie
chart segments to be specified. Theta2 allows an end angle to be specified in
radians (where 0 is 'north'), useful for individual 'pie' segments.
R and R2 position the outer and inner radial edges of an arc segment. Useful
for rose diagrams where arc radii are data-driven.
Longitude/Longitude2 and Latitude/Latitude2 are the equivalent for
geographic positioning subject to projection.
XError/XError2 and YError/YError2 are used when specifying bounds of an
errorbar mark.
Name of field used for encoding with a position channel.
Reference in a position channel to a field name generated by repeatFlow or repeat. The parameter identifies whether reference is being made to fields that are to be encoded in layers, or in columns / rows with a flow layout. For example,
enc =
encoding
<< position X [ pRepeat arFlow, pQuant ]
spec =
asSpec [ data [], tick [], enc [] ]
toVegaLite
[ repeatFlow [ "Horsepower", "Miles_per_Gallon", "Acceleration"]
, specification spec
]Indicate a data field encoded as a position is nominal. This is the default data type.
Indicate a data field encoded as a position is ordinal.
Indicate a data field encoded as a position is a geo feature.
Discretize numeric values into bins when encoding with a position channel. For non-default binning, bin-widths, extent etc. can be specified in the first parameter. For example, to encode a frequency histogram with bins every 5 units. For example,
enc =
encoding
<< position X [ pName "x", pOrdinal, pBin [ biStep 5 ] ]
<< position Y [ pQuant, pAggregate opCount ]Indicate that data encoded with position are already binned.
Form of time unit aggregation of field values when encoding with a position channel.
Title of a field when encoding with a position channel. For multi-line titles,
insert \n at each line break or use a """ multi-line string.
Compute some aggregate summary statistics for a field to be encoded with a position channel. The type of aggregation is determined by the given operation parameter. For example,
enc =
encoding
<< position X [ pName "role", pOrdinal ]
<< position Y [ pName "salary", pQuant, pAggregate opMean ]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 example, the following will scale the bars positioned along a horizontal axis to have an inner spacing of 50% (0.5) of the total space allocated to each bar:
enc =
encoding
<< position X [ pName "ageGroup", pNominal, pScale [ scPaddingInner 0.5 ] ]Axis properties used when encoding with a position channel. For no axis, provide an empty list.
Sort order for field when encoding with a position channel.
Specify mark position or size relative to band size. For non-rect marks, the relative position on a band of a stacked, binned, time unit or band scale is used. A value of 0, positions the mark at the beginning of the band; 0.5, in the middle etc.
For rect-based marks (rect, bar, and image), if set to 1, the mark size is set to the band width or the time unit interval. If set to 0.5, the mark size is half of the bandwidth or the time unit interval. etc.
Type of stacking offset for field when encoding with a position channel. For example, stacking areas away from a centre-line can be used to create a streamgraph:
enc =
encoding
<< position X [ pName "week", pOrdinal ]
<< position Y [ pName "takings", pQuant, pStack stCenter ]
<< color [ mName "shop", mNominal ]Set the position to the width of the enclosing data space. Useful for justifying a mark to the right hand edge of a view. e.g. to position a mark at the right of the data rectangle. For example,
enc =
encoding
<< position X [ pWidth ]Set the position to the height of the enclosing data space. Useful for placing a mark relative to the bottom edge of a view.
Imputation rules for a position channel. See the
Vega-Lite impute documentation
For example, to impute the missing value of b with the mean of existing b values,
when a is 30 and its color group (c) is 1:
let
data =
dataFromColumns []
<< dataColumn "a" (nums [ 0, 0, 10, 10, 20, 20, 30 ])
<< dataColumn "b" (nums [ 28, 91, 43, 55, 81, 53, 19 ])
<< dataColumn "c" (nums [ 0, 1, 0, 1, 0, 1, 0 ])
enc =
encoding
<< position X [ pName "a", pQuant ]
<< position Y [ pName "b", pQuant, pImpute [ imMethod imMean ] ]
<< color [ mName "c", mNominal ]
in
toVegaLite [ data [], enc [], line [] ]See the Vega-Lite sort documentation.
Indicate sorting is to be applied from low to high.
Indicate sorting is to be applied from high to low.
Sort by the aggregated summary of a given field using a given aggregation
operation. Used by pSort, mSort, oSort and
fSort. For example, to sort the categorical data field variety by
the mean age of the data in each variety category:
position Y
[ pName "variety"
, pOrdinal
, pSort [ soByField "age" opMean, soDescending ]
]Provide an expression to an axis property function requiring a Boolean value. This can be used to provide an interactive parameterisation of an axis property when an expression is bound to an input element. Used by pAxis. For example,
ps =
params
<< param "lbls"
[ paValue (boo True)
, paBind (ipCheckbox [])
]
enc =
encoding
<< position X
[ pName "x"
, pAxis [ axBooExpr "lbls" axLabels ]
]Provide an expression to an axis configuration function requiring a Boolean value. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Provide an expression to an axis property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. Used by pAxis. For example,
ps =
params
<< param "axo"
[ paValue (num 0)
, paBind (ipRange [ inMax 20 ])
]
enc =
encoding
<< position X
[ pName "x"
, pAxis [ axNumExpr "axo" axOffset ]
]Provide an expression to an axis property configuration function requiring a numeric value. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Provide an expression to an axis property function requiring a list of numbers (for dash styles). This can be used to provide an interactive parameterisation of an axis dash property when an expression is bound to an input element. Used by pAxis. For example,
ps =
params
<< param "gridDash"
[ paValue (nums [ 2, 2 ])
, paBind (ipSelect [ inDataOptions [ nums [ 2, 2 ], nums [ 8, 8 ] ] ])
]
enc =
encoding
<< position X [ pAxis [ axNumsExpr "gridDash" axGridDash ] ]Provide an expression to an axis configuration function requiring a list of numbers (for dash styles). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Provide an expression to an axis property function requiring a string value. This can be used to provide an interactive parameterisation of an axis property when an expression is bound to an input element. Used by pAxis. For example,
ps =
params
<< param "color"
[ paValue (str "black")
, paBind (ipColor [])
]
enc =
encoding
<< position X
[ pName "x"
, pAxis [ axStrExpr "color" axTitleColor ]
]Provide an expression to an axis configuration function requiring a string value. This can be used to provide an interactive parameterisation of an axis configuration property when an expression is bound to an input element. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Position of axis tick relative to a band (0 to 1). Used by pAxis.
Maximum extent in pixels that axis ticks and labels should use. Used by pAxis.
Minimum extent in pixels that axis ticks and labels should use. Used by pAxis.
Orientation of an axis relative to the plot it is describing. Used by pAxis.
Offset to displace the axis from the edge of the enclosing group or data rectangle. Used by pAxis.
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. Used by pAxis.
Drawing order of the axis and its associated features (grid lines, ticks etc.) relative to the other chart elements. A value greater than 0 indicates axis is drawn in front of chart marks, 0 indicates it is drawn behind them. The z-order of intersecting grid lines associated with x- and y- axes can be controlled by assigning a higher z-value to the axis to appear on top. Used by pAxis.
Make an axis property (tick, grid or label) conditional on one or more predicate expressions. The first parameter is the test to apply. The second is a pair of properties to set if the test evaluates to true or false.
The test parameter has access to the axis properties value and label corresponding
to the value associated with an individual axis element and its text label. These
should be used rather than the underlying data field when referencing a data value.
pAxis
[ axDataCondition (expr "datum.value <= 2")
(cAxTickColor "red" "blue")
, axDataCondition (expr "datum.label =='4.0'")
(cAxTickWidth 5 2)
]You can also apply inline aggregation before applying the test using fiOpTrans, which can be particularly useful for filtering temporal data. Used by pAxis. For example, the following will apply solid grid lines for January 1st of each year and dashes for all other dates:
pAxis
[ axDataCondition
(fiEqual "value" (dt [ dtMonth Jan, dtDate 1 ])
|> fiOpTrans (mTimeUnit monthDate)
)
(cAxGridDash [] [ 2, 2 ])
]A list of named styles to apply to an axis. Named styles can be specified via coAxisStyles. Later styles in the list will override earlier styles if there is a conflict in any of the properties specified. Used by pAxis.
While this is provided for compatibility with Vega-Lite style specification, for greater type safety in elm-vegalite, instead create functions that generate AxisProperties.
Coordinate space translation offset for axis layout. By default, axes are translated by 0.5 pixels for both the x and y coordinates in order to align stroked lines with the pixel grid. This translation can be changed, for example, to zero. Used by pAxis.
Whether or not an axis baseline (domain) should be included as part of an axis. Used by pAxis.
Dash style of axis baseline (domain). The parameter should list number of pixels in alternating dash and gap lengths. Used by pAxis.
Number of pixels before the first axis baseline (domain) line dash is drawn. Used by pAxis.
How the ends of the axis baseline (domain) are capped. Used by pAxis.
Color of axis domain line. Used by pAxis.
Opacity of axis domain line. Used by pAxis.
Width of axis domain line. Used by pAxis.
Formatting pattern for axis labels. To distinguish between formatting as numeric values and data/time values, additionally use axFormatAsNum, axFormatAsTemporal or axFormatAsCustom. Used by pAxis.
Specify multiple time formats for axis labels that might vary according to the temporal resolution. This is especially useful when used with paBindScales that will adjust the granularity of time labels dynamically. The parameter is a list of time units to customise and their respective formatting pattern. Used by pAxis. For example,
pAxis
[ axTemporalFormats
[ ( year, "`%Y" )
, ( hours, "kl %-H" )
, ( minutes, "%H:%M" )
]
]Indicate that axis labels should be formatted as numbers. To control the precise numeric format, additionally use axFormat providing a d3 numeric format string. Used by pAxis.
Indicate that axis labels should be formatted as dates/times. To control the precise temporal format, use axFormat or axTemporalFormats providing d3 date/time format strings. Used by pAxis.
Indicate that axis labels should be formatted with a registered custom formatter with the given name. See how to register a Vega-Lite custom formatter. Used by pAxis.
Whether or not axis labels should be displayed. Used by pAxis.
Horizontal alignment of axis tick labels. Used by pAxis.
Conditional axis label alignment. The first parameter provides the alignment when a predicate is true, the second when it is false. Used by axDataCondition.
Rotation angle of axis labels (degrees from horizontal). Used by pAxis.
Vertical alignment of axis tick labels. Used by pAxis.
Conditional axis vertical label alignment. The first parameter provides the alignment when a predicate is true, the second when it is false. Used by axDataCondition.
How or if labels should be hidden if they exceed the axis range. If
Nothing, no check for label size is made. A number specifies the permitted
overflow in pixels. Used by pAxis.
Expression that evaluates to True, False or a number depending whether a check is to be made for an axis label size. A number specifies the permitted overflow in pixels. Used by pAxis.
Color of axis tick label. Used by pAxis.
Conditional axis label color. The first parameter provides the color when a predicate is true, the second when it is false. Used by axDataCondition.
An expression to generate axis labels. The parameter is a valid
Vega expression. Can reference
datum.value and datum.label for access to the underlying data values and
default label text respectively. Used by pAxis. For example, to provide 4 digit
years every decade and 2-digit years for all other tick marks:
pAxis
[ axLabelExpr "if(year(datum.value) % 10 == 0"
++ ", utcFormat(datum.value,'%Y')"
++ ", utcFormat(datum.value,'%y'))"
]How or if labels at beginning and end of the axis should be aligned. Specifies
the distance threshold from an end-point within which labels are flush-adjusted
or if Nothing, no flush-adjustment made. Used by pAxis.
Number of pixels by which to offset flush-adjusted labels. Used by pAxis.
Font name of an axis label. Used by pAxis.
Conditional axis label font. The first parameter provides the font when a predicate is true, the second when it is false. Used by axDataCondition.
Font size of an axis label. Used by pAxis.
Conditional axis label font size. The first parameter provides the size when a predicate is true, the second when it is false. Used by axDataCondition.
Font style of an axis label (e.g. "italic"). Used by pAxis.
Conditional axis label font style. The first parameter provides the style when a predicate is true, the second when it is false. Used by axDataCondition.
Font weight of an axis label. Used by pAxis.
Conditional axis label font weight. The first parameter provides the weight when a predicate is true, the second when it is false. Used by axDataCondition.
Maximum length in pixels of axis tick labels. Used by pAxis.
Axis label line height (useful for multi-line labels). Used by pAxis.
Offset in pixels of an axis's labels relative to its ticks. Used by pAxis.
Conditional axis label offset. The first parameter provides the offset when a predicate is true, the second when it is false. Used by axDataCondition.
Opacity of an axis label. Used by pAxis.
Conditional axis label opacity. The first parameter provides the opacity when a predicate is true, the second when it is false. Used by axDataCondition.
Overlap strategy for labels when they are too large to fit within the space devoted to an axis. Used by pAxis.
Padding in pixels between an axis and its text labels. Used by pAxis.
Conditional axis label padding. The first parameter provides the padding when a predicate is true, the second when it is false. Used by axDataCondition.
The minimum separation between labels (in pixel units) before they are considered non-overlapping. Ignored if axLabelOverlap is osNone. Used by pAxis.
Whether or not an axis should include tick marks. Used by pAxis.
Where grid and ticks should be aligned with bands. Used by pAxis.
Align to centre of tick band.
Align to extent (edges) of tick band.
Specify a tick band alignment with an expression that should evaluate to "center" or "extent".
How the ends of axis ticks are capped. Used by pAxis.
Color of axis ticks. Used by pAxis.
Conditional axis tick color. The first parameter provides the color when a predicate is true, the second when it is false. Used by axDataCondition.
Desired number of, or interval between, axis ticks. The resulting number of ticks may be different so that values are “nice” (multiples of 2, 5, 10). Used by pAxis.
Axis tick dash style. The parameter is a list of alternating 'on' and 'off' lengths in pixels representing the dashed line. Used by pAxis.
Conditional axis tick dash style. The first parameter is a list of alternating 'on' and 'off' lengths in pixels representing the dashed line when a predicate is true, the second when it is false. Used by axDataCondition.
Number of pixels before the first axis tick dash is drawn. Used by pAxis.
Conditional axis tick dash offset. The first parameter provides the dash offset when a predicate is true, the second when it is false. Used by axDataCondition.
Whether or not an extra axis tick should be added for the initial position of an axis. Used by pAxis.
The minimum desired step between axis ticks, in terms of scale domain values.
For example, a value of 1 indicates that ticks should not be less than 1 unit
apart. If specified, the tick count value will be adjusted, if necessary, to
enforce the minimum step value. Used by pAxis.
Offset in pixels of an axis's ticks, labels and gridlines. Used by pAxis.
Opacity of axis ticks. Used by pAxis.
Conditional axis tick opacity. The first parameter provides the opacity when a predicate is true, the second when it is false. Used by axDataCondition.
Whether or not axis tick positions should be rounded to nearest integer. Used by pAxis.
Tick mark size in pixels. Used by pAxis.
Conditional axis tick size. The first parameter provides the size when a predicate is true, the second when it is false. Used by axDataCondition.
Width of axis ticks. Used by pAxis.
Conditional axis tick width. The first parameter provides the width when a predicate is true, the second when it is false. Used by axDataCondition.
Set explicit tick/grid/label values along an axis. Used by pAxis. For example, for a quantitative field:
pAxis [ axValues (nums [ 2, 3, 5, 7, 11, 13, 17 ]) ]or a categorical field:
pAxis [ axValues (strs [ "cats", "dogs", "parrots" ]) ]or for a temporal field:
pAxis
[ axValues
(dts
[ [ dtYear 2019, dtMonth Mar, dtDate 31 ]
, [ dtYear 2019, dtMonth Jun, dtDate 30 ]
, [ dtYear 2019, dtMonth Sep, dtDate 30 ]
, [ dtYear 2019, dtMonth Dec, dtDate 31 ]
]
)
]Title to display as part of an axis. An empty string can be used to prevent
a title being displayed. For multi-line titles, insert \n at each line break or
use a """ multi-line string. Used by pAxis.
Horizontal alignment of an axis title. Used by pAxis.
Anchor position of an axis title. Used by pAxis.
Angle of an axis title (degrees from horizontal). Used by pAxis.
Vertical alignment of axis title. Used by pAxis.
Color of axis title. Used by pAxis.
Font name for an axis title. Used by pAxis.
Font size of an axis title. Used by pAxis.
Font style of an axis title (e.g. "italic"). Used by pAxis.
Font weight of an axis title. Used by pAxis.
Maximum length in pixels of axis title. Used by pAxis.
Line height for multi-line axis titles. Used by pAxis.
Opacity of an axis title. Used by pAxis.
Padding in pixels between a title and axis. Used by pAxis.
X position of an axis title relative to the axis group. Used by pAxis.
Y position of an axis title relative to the axis group. Used by pAxis.
Whether or not grid lines should be included as part of an axis. Used by pAxis.
How the ends of gridlines are capped. Used by pAxis.
Color of grid lines associated with an axis. Used by pAxis.
Conditional axis grid color. The first parameter provides the color when a predicate is true, the second when it is false. Used by axDataCondition.
Axis grid lines dash style. The parameter is a list of alternating 'on' and 'off' lengths in pixels representing the dashed line. Used by pAxis.
Conditional axis grid dash. The first parameter provides the dash when a predicate is true, the second when it is false. Used by axDataCondition.
Default number of pixels before the first axis grid line dash is drawn. Used by pAxis.
Conditional axis grid dash offset. The first parameter provides the dash offset when a predicate is true, the second when it is false. Used by axDataCondition.
Opacity of grid lines associated with an axis. Used by pAxis.
Conditional axis grid opacity. The first parameter provides the opacity when a predicate is true, the second when it is false. Used by axDataCondition.
Width of grid lines associated with an axis. Used by pAxis.
Conditional axis grid width. The first parameter provides the width when a predicate is true, the second when it is false. Used by axDataCondition.
Left horizontal text alignment. Used by maAlign, axLabelAlign, cAxLabelAlign, axTitleAlign, leLabelAlign, leTitleAlign, hdLabelAlign, hdTitleAlign, axcoLabelAlign, axcoTitleAlign, lecoLabelAlign and lecoTitleAlign.
Center horizontal text alignment. Used by maAlign, axLabelAlign, cAxLabelAlign, axTitleAlign, leLabelAlign, leTitleAlign, hdLabelAlign, hdTitleAlign, axcoLabelAlign, axcoTitleAlign, lecoLabelAlign and lecoTitleAlign.
Right horizontal text alignment. Used by maAlign, axLabelAlign, cAxLabelAlign, axTitleAlign, leLabelAlign, leTitleAlign, hdLabelAlign, hdTitleAlign, axcoLabelAlign, axcoTitleAlign, lecoLabelAlign and lecoTitleAlign.
Expression that evaluates to some text alignment such as "left", "right" or "center". Used by maAlign, axLabelAlign, cAxLabelAlign, axTitleAlign, leLabelAlign, leTitleAlign, hdLabelAlign, hdTitleAlign, axcoLabelAlign, axcoTitleAlign, lecoLabelAlign and lecoTitleAlign. Can be used, for example, to align text to the left or right depending on whether data values are positive or negative:
maAlign (haExpr "datum.x < 0 ? 'right' : 'left'")Vertically align text marks by the top of ascenders (e.g. top of an 'A'). Used by maBaseline, axLabelBaseline, cAxLabelBaseline, axTitleBaseline, leLabelBaseline, leTitleBaseline, hdLabelBaseline, hdTitleBaseline, tiBaseline, axcoLabelBaseline, axcoTitleBaseline, lecoLabelBaseline, lecoTitleBaseline and ticoBaseline.
Vertically align text marks by the top of the space defined by line height (maLineHeight, tiLineHeight etc.). Used by maBaseline, axLabelBaseline, cAxLabelBaseline, axTitleBaseline, leLabelBaseline, leTitleBaseline, hdLabelBaseline, hdTitleBaseline, tiBaseline, axcoLabelBaseline, axcoTitleBaseline, lecoLabelBaseline, lecoTitleBaseline and ticoBaseline.
Vertically align text marks by their middle (e.g. middle of an 'x'). Used by maBaseline, axLabelBaseline, cAxLabelBaseline, axTitleBaseline, leLabelBaseline, leTitleBaseline, hdLabelBaseline, hdTitleBaseline, tiBaseline, axcoLabelBaseline, axcoTitleBaseline, lecoLabelBaseline, lecoTitleBaseline and ticoBaseline.
Vertically align text marks by the bottom of descenders (e.g. bottom of a 'g'). Used by maBaseline, axLabelBaseline, cAxLabelBaseline, axTitleBaseline, leLabelBaseline, leTitleBaseline, hdLabelBaseline, hdTitleBaseline, tiBaseline, axcoLabelBaseline, axcoTitleBaseline, lecoLabelBaseline, lecoTitleBaseline and ticoBaseline.
Vertically align text marks by the bottom of the space defined by line height (maLineHeight, tiLineHeight etc.). Used by maBaseline, axLabelBaseline, cAxLabelBaseline, axTitleBaseline, leLabelBaseline, leTitleBaseline, hdLabelBaseline, hdTitleBaseline, tiBaseline, axcoLabelBaseline, axcoTitleBaseline, lecoLabelBaseline, lecoTitleBaseline and ticoBaseline.
Vertically align text marks by their baseline (e.g. bottom of an 'x'). Used by maBaseline, axLabelBaseline, cAxLabelBaseline, axTitleBaseline, leLabelBaseline, leTitleBaseline, hdLabelBaseline, hdTitleBaseline, tiBaseline, axcoLabelBaseline, axcoTitleBaseline, lecoLabelBaseline, lecoTitleBaseline and ticoBaseline.
Expression that evaluates to some vertical text alignment such as "top", "bottom" or "alphabetic". Used by maBaseline, axLabelBaseline, cAxLabelBaseline, axTitleBaseline, leLabelBaseline, leTitleBaseline, hdLabelBaseline, hdTitleBaseline, tiBaseline, axcoLabelBaseline, axcoTitleBaseline, lecoLabelBaseline, lecoTitleBaseline and ticoBaseline.
No overlap strategy to be applied when there is not space to show all items on an axis. Used by axLabelOverlap, leLabelOverlap, axcoLabelOverlap and lecoLabelOverlap.
Greedy overlap strategy to be applied when there is not space to show all items on an axis. Used by axLabelOverlap, leLabelOverlap, axcoLabelOverlap and lecoLabelOverlap.
Give all items equal weight in overlap strategy to be applied when there is not space to show them all on an axis. Used by axLabelOverlap, leLabelOverlap, axcoLabelOverlap and lecoLabelOverlap.
Specify an overlap strategy with an expression that should evaluate to one of True, False, "parity" or "greedy". Used by axLabelOverlap, leLabelOverlap, axcoLabelOverlap and lecoLabelOverlap.
Top side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.
Bottom side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.
Left side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.
Right side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.
Specify a side position with an interactive expression. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.
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 size encoding options such as the data to encode, size scaling etc.
enc =
encoding
<< size [ mName "population", mQuant ]Encode an angle (orientation) channel. This allows data-driven rotation of text, point-based marks.
Encode a color channel. The first parameter is a list of color encoding options such as the data to encode, colour scaling etc.
enc =
encoding
<< color [ mName "avHireTime", mQuant ]Encode a fill channel. This acts in a similar way to encoding by color but
only affects the interior of closed shapes. 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.
Encode a stroke dash channel.
enc =
encoding
<< position X [ pName "date", pTemporal ]
<< position Y [ pName "price", pQuant ]
<< strokeDash [ mName "company" ]Encode a stroke width channel.
Encode an opacity channel.
Encode a fill opacity channel. This acts in a similar way to encoding by opacity
but only affects the interior of closed shapes. If both fillOpacity and opacity
encodings are specified, fillOpacity takes precedence.
Encode a stroke opacity channel. This acts in a similar way to encoding by
opacity but only affects the exterior boundary of marks. If both opacity and
strokeOpacity are specified, strokeOpacity takes precedence for stroke encoding.
Encode a shape channel. The first parameter is a list of shape encoding options such as the data to encode, custom shape encodings etc.
enc =
encoding
<< shape [ mName "company", mNominal ]Reference in a mark channel to a field name generated by repeatFlow or repeat. The parameter identifies whether reference is being made to fields that are to be encoded in layers, or in columns / rows with a flow layout. Used by functions that influence mark channels such as size and color.
Reference in a mark channel to a datum value generated by repeatFlow or repeat. The parameter identifies whether reference is being made to a datum that is to be encoded in layers, or in columns / rows with a flow layout. Used by functions that influence mark channels such as size and color.
Indicate a data field encoded as a mark property is nominal. This is the default data type.
Indicate a data field encoded as a mark property is ordinal.
Indicate a data field encoded as a mark property is quantitative.
Indicate a data field encoded as a mark property is temporal.
Indicate a data field encoded as a mark property is a geo feature.
Indicate that data encoding with a mark are already binned.
SVG path string used when encoding with a mark property channel. Useful for providing custom shapes.
Provide an expression to a mLegend property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. For example,
ps =
params
<< param "xPos"
[ paValue (num 0)
, paBind (ipRange [ inMax 100 ])
]
enc =
encoding
<< color
[ mName "animal"
, mLegend [ leNumExpr "xPos" leX ]
]Used by coLegend to provide an expression to a legend configuration function requiring a numeric value.
Provide an expression to an mLegend property function requiring a list of numbers (for dash styles). This can be used to provide an interactive parameterisation of an axis dash property when an expression is bound to an input element. For example,
ps =
params
<< param "dashStyle"
[ paValue nums []
, paBind (ipSelect [ inDataOptions [ nums [ 2, 2 ], nums [ 8, 8 ] ] ])
]
enc =
encoding
<< color
[ mName "country"
, mLegend [ leNumsExpr "dashStyle" leSymbolDash ]
]Used by coLegend to provide an expression to a legend property configuration requiring a list of numbers (for dash styles).
Provide an expression to an mLegend property function requiring a string value. This can be used to provide an interactive parameterisation of a legend property when an expression is bound to an input element. For example,
ps =
params
<< param "color"
[ paValue (str "black")
, paBind (ipColor [])
]
enc =
encoding
<< color
[ mName "animal"
, mLegend [ leStrExpr "color" leTitleColor ]
]Used by coLegend to provide an expression to an legend configuration function requiring a string value.
Used by leType to specify a gradient legend for continuous quantitative data.
Limit height of mLegend entries.
Horizontal padding between symbol mLegend entries.
Number of columns in which to arrange symbol mLegend entries.
mLegend corner radius.
Direction of an mLegend.
mLegend background color.
Formatting pattern for mLegend values. To distinguish between formatting as numeric values and data/time values, additionally use leFormatAsNum, leFormatAsTemporal or leFormatAsCustom.
Indicate that mLegend labels should be formatted as numbers. To control the precise numeric format, additionally use leFormat providing a d3 numeric format string.
Indicate that mLegend labels should be formatted as dates/times. To control the precise temporal format, additionally use leFormat providing a d3 date/time format string.
Indicate that mLegend labels should be formatted with a registered custom formatter with the given name. See how to register a Vega-Lite custom formatter.
Length in pixels of the primary axis of a color ramp mLegend.
Used by coLegend to specify the default maximum length in pixels of a horizontal color ramp legend.
Used by coLegend to specify the default minimum length in pixels of a horizontal color ramp legend.
Used by coLegend to specify the default maximum length in pixels of a vertical color ramp legend.
Used by coLegend to specify the default minimum length in pixels of a vertical color ramp legend.
Opacity of a color ramp mLegend.
Thickness in pixels of a color ramp mLegend.
Color for strokes in a color ramp mLegend.
Width for strokes in a color ramp mLegend.
Alignment to apply to a symbol mLegend rows and columns.
Horizontal alignment of mLegend labels.
Vertical alignment of mLegend labels.
Color for mLegend labels.
An expression to generate mLegend labels. The parameter is a valid
Vega expression. Can reference
datum.value and datum.label for access to the underlying data values and
default label text respectively. For example, to show just the first word of
each legend category:
mLegend [ leLabelExpr "split(datum.value,' ')[0]" ]Font for mLegend labels.
Font size mLegend labels.
Font style (e.g italic) for mLegend labels.
Font weight for mLegend labels.
Maximum width for mLegend labels in pixel units.
Offset for mLegend labels.
Strategy for resolving overlapping mLegend labels.
Offset in pixels of a mLegend from the encoded marks it describes.
If the legend orientation is one of loTop, loBottom, loLeft or loRight,
a positive offset moves the legend outwards away from the encoded marks. If it is
one of loTopLeft, loTopRight, loBottomLeft or loBottomRight a positive
offset will move it inwards away from the corner. If loNone, the offset has no effect.
Position of a mLegend in a scene.
Padding in pixels between an mLegend and axis.
Vertical spacing in pixel units between a symbol mLegend entries.
mLegend border color.
mLegend border stroke width.
Symbol dash style in an mLegend.
Symbol dash offset in an mLegend.
mLegend symbol fill color.
Maximum number of symbols in an mLegend.
Symbol offset between mLegend symbols and legend area.
mLegend symbol opacity.
mLegend symbol size.
mLegend symbol outline color.
mLegend symbol stroke width.
mLegend symbol type.
Number of tick marks in a quantitative mLegend.
Title of an mLegend. For multi-line titles, insert \n
at each line break or use a """ multi-line string.
Horizontal alignment for mLegend titles.
Horizontal alignment for mLegend titles.
Vertical alignment for mLegend titles.
Color for mLegend title.
Font for mLegend titles.
Font size for mLegend titles.
Font style (italic etc.) for mLegend titles.
Font weight for mLegend titles.
Maximum size in pixel units for mLegend titles.
Height in pixels for each line of a multi-line mLegend title.
Opacity of an mLegend title.
Position of an mLegend title relative to the main legend content.
Spacing in pixel units between title and mLegend.
Type of mLegend.
An explicit set of mLegend values.
Drawing order of an mLegend relative to other chart elements. To place a legend in front of others use a positive integer, or 0 to draw behind.
Used by leOrient, leTitleOrient and lecoOrient to position legend to the left of the visualization it describes.
Used by leOrient, leTitleOrient and lecoOrient to position legend outside and to the right of the visualization it describes.
Used by leOrient, leTitleOrient and lecoOrient to position legend outside and above the visualization it describes.
Used by leOrient, leTitleOrient and lecoOrient to position legend outside and below the visualization it describes.
Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the top-left corner.
Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the top-right corner.
Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the bottom-left corner.
Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the bottom-right corner.
Used by leOrient, leTitleOrient and lecoOrient to
prevent automatic legend positioning (allows legend to be located explicitly via x y coordinates).
Relate to the appearance of the text and tooltip elements of the visualization. See the Vega-Lite text documentation
Encode a text channel. The first parameter is a list of text encoding options such as the data to encode, number formatting etc.
enc =
encoding
<< text [ tName "keyword", tNominal ]Encode a tooltip channel using a single data field.
tooltip [ tName "Month", tTemporal, tFormat "%B %Y" ]To encode multiple tooltip values with a mark, use tooltips. This is
also useful if you wish the field name to be displayed along with the value, as
by default, tooltip will only show the value.
Encode a tooltip channel using multiple data fields. The first parameter is a list of the multiple tooltips, each of which is a list of text channel properties that define the channel.
tooltips
[ [ tName "month", tTemporal, tFormat "%B %Y" ]
, [ tName "temperature", tQuant ]
]Thsi multi-tooltip version (rather than tooltip) should also be used if you wish to display images in tooltips. For example,
tooltips [ [ tName "image" ] ]Name of field used for encoding with a text channel. Used by text, tooltip and tCondition.
Reference in a text channel to a field name generated by repeatFlow or repeat. The parameter identifies whether reference is being made to fields that are to be arranged in columns, in rows or a with a flow layout. Used by text, tooltip and tCondition.
Indicate a data field encoded as a text property is nominal. This is the default data type. Used by text, tooltip and tCondition.
Indicate a data field encoded as a text property is ordinal. Used by text, tooltip and tCondition.
Indicate a data field encoded as a text property is quantitative. Used by text, tooltip and tCondition.
Indicate a data field encoded as a text property is temporal. Used by text, tooltip and tCondition.
Indicate a data field encoded as a text property is a geo feature. Used by text, tooltip and tCondition.
Discretize numeric values into bins when encoding with a text channel. Used by text, tooltip and tCondition.
Indicate that data encoded with a text channel are already binned. Used by text, tooltip and tCondition.
Compute some aggregate summary statistics for a field to be encoded with a text channel. The type of aggregation is determined by the given operation parameter. Used by text, tooltip and tCondition.
Time unit aggregation of field values when encoding with a text channel. Used by text, tooltip and tCondition.
Title of a field when encoding with a text or tooltip channel. For multi-line
titles, insert \n at each line break or use a """ multi-line string.
Used by text, tooltip and tCondition.
Literal string value when encoding with a text channel. Can be useful for
quick text annotation. Used by text, tooltip and tCondition.
For multi-line text, insert \n at each line break or use a """ multi-line string. For example,
encoding
<< position X [ pNum 300 ]
<< position Y [ pNum 300 ]
<< text [ tStr "Upper limit\nof range" ]Name of a literal data item used for encoding with a text channel. Unlike tStr datum literals represent values in data space. Used by text, tooltip and tCondition.
Formatting pattern for text marks. To distinguish between formatting as numeric values and data/time values, additionally use tFormatAsNum, tFormatAsTemporal or tFormatAsCustom. Used by text, tooltip and tCondition.
Indicate that values encoded with a text channel should be formatted as numbers. To control the precise numeric format, additionally use tFormat providing a d3 numeric format string. Used by text, tooltip and tCondition.
Indicate that values encoded with a text channel should be formatted as dates/times. To control the precise temporal format, additionally use tFormat providing a d3 date/time format string. Used by text, tooltip and tCondition.
Indicate that values encoded with a text channel should be formatted with a registered custom formatter with the given name. Used by text, tooltip and tCondition. See how to register a Vega-Lite custom formatter.
Specify a bold font weight.
Specify a bolder font weight.
Specify a lighter font weight.
Specify a normal font weight.
Specify a numeric font weight that should be between 100 (lightest) and 900 (boldest).
Expression that evaluates to some font weight such as "bold", "lighter" or "600".
Relates to a clickable URL destination of a mark. 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. See the Vega-Lite hyperlink documentation
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.
encData =
encoding
<< hyperlink [ hName "url", hNominal ]
encLiteral =
encoding
<< hyperlink [ hStr "http://www.imdb.com" ]Reference in a hyperlink channel to a field name generated by repeatFlow or repeat. The parameter identifies whether reference is being made to fields that are to be arranged in columns, in rows or a with a flow layout. Used by hyperlink and url.
Indicate a data field encoded as a hyperlink or url property is temporal.
Encode a url channel. The first parameter is a list of url channel properties that characterise the hyperlink to encode with. This is used for specifying data-driven image files for the image mark.
encData =
encoding
<< url [ hName "url", hNominal ]
encLiteral =
encoding
<< url [ hStr "http://www.imdb.com" ]Channel 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 order documentation.
Encode an order channel. The first parameter is a list of order encoding options such as the data to encode, sort direction etc.
enc =
encoding
<< order [ oName "yield", oOrdinal, oSort [ soDescending ] ]Name of field used for encoding with an order channel.
Reference in a order channel to a field name generated by repeatFlow or repeat. The parameter identifies whether reference is being made to fields that are to be arranged in columns, in rows or a with a flow layout. Used by order and oCondition.
Indicate a data field encoded with an order channel is nominal. Used by order and oCondition.
Indicate a data field encoded with an order channel is ordinal. Used by order and oCondition.
Indicate a data field encoded with an order channel is quantitative. Used by order and oCondition.
Indicate a data field encoded with an order channel is temporal. Used by order and oCondition.
Indicate a data field encoded with an order channel is a geo feature. Used by order and oCondition.
Discretize numeric values into bins when encoding with an order channel. Used by order and oCondition.
Compute some aggregate summary statistics for a field to be encoded with an order channel. The type of aggregation is determined by the given operation parameter. Used by order and oCondition.
Sort order to be used by an order channel. Used by order and oCondition.
Time unit aggregation of field values when encoding with an order channel. Used by order and oCondition.
Specify a literal numeric value for an order channel. Useful for setting a conditional z-order with interaction to bring selected feature to 'front'.
Channel 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 facet documentation. 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. See the Vega-Lite row documentation.
Note that when faceting, dimensions specified with width and height refer to the individual faceted plots, not the assemblage as a whole.
let
data =
dataFromUrl "crimeData.csv"
enc =
encoding
<< position X [ pName "month", pTemporal ]
<< position Y
[ pName "reportedCrimes"
, pQuant
, pAggregate opSum
, pTitle ""
]
<< row [ fName "crimeType", fNominal ]
in
toVegaLite [ height 80, data [], bar [], enc [] ]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. See the Vega-Lite column documentation
Note that when faceting, dimensions specified with width and height refer to the individual faceted plots, not the assemblage as a whole.
let
data =
dataFromUrl "crimeData.csv"
enc =
encoding
<< position X [ pName "month", pTemporal ]
<< position Y [ pName "reportedCrimes", pQuant, pAggregate opSum ]
<< column [ fName "crimeType", fNominal ]
in
toVegaLite [ width 100, data [], bar [], enc [] ]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. See the Vega-Lite documentation.
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.
enc =
encoding
<< detail [ dName "avHireTime", dQuant ]Name of field used for encoding with a level of detail (grouping) channel.
Indicate a data field encoded with a detail channel is nominal. This is the default data type.
Indicate a data field encoded with a detail channel is ordinal.
Indicate a data field encoded with a detail channel is quantitative.
Indicate a data field encoded with a detail channel is temporal.
Indicate a data field encoded with a detail channel is a geo feature.
Compute some aggregate summary 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.
Discretize numeric values into bins when encoding with a level of detail (grouping) channel.
Form of time unit aggregation of field values when encoding with a level of detail (grouping) channel.
Enables object constancy for transitions over dynamic data. When a visualization’s data is updated (via the Vega View API, the key value will be used to match data elements to existing mark instances. See the Vega-Lite key channel documentation.
Encode a key channel for use with the Vega View API. The first parameter identifies a list of key encoding options (just the name of the data field to use as a unique key for data binding and its type).
Name of field used for encoding with a key channel.
Indicate a data field encoded as a key channel property is nominal. This is the default data type.
Indicate a data field encoded as a key channel property is ordinal.
Indicate a data field encoded as a key channel property is quantitative.
Indicate a data field encoded as a key channel property is temporal.
Indicate a data field encoded as a key channel property stores geo-features.
Used to specify how the encoding of a data field should be applied. See the Vega-Lite scale documentation.
Provide an expression to a scale property function requiring a numeric value. This can be used to provide an interactive parameterisation of a mark property by providing an expression bound to an input element. Used by pScale and mScale. For example,
ps =
params
<< param "pad"
[ paValue (num 0)
, paBind (ipRange [ inMax 100 ])
]
enc =
encoding
<< position X [ mName "val" mScale [ scNumExpr "pad" scPadding ] ]Provide an expression to a scale property function requiring a Boolean value. This can be used to provide an interactive parameterisation of a mark property by providing an expression bound to an input element. For example,
ps =
params
<< param "rev"
[ paValue (boo False)
, paBind (ipCheckbox [ inName "reverse colours" ])
]
enc =
encoding
<< color [ mName "val" mScale [ scBooExpr "rev" scReverse ] ]Describes the data values that will be encoded.
Provide an expression to a domain scale property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. For example,
ps =
params
<< param "upper"
[ paValue (num 50)
, paBind (ipRange [ inMax 100 ])
]
enc =
encoding
<< position X
[ pName "x"
, pScale [ scDomain (doNumExpr "upper" doMax) ]
]Provide a custom scaling domain (data extent). This can be useful for fixing the data extent when interactively filtering or faceting so providing a 'global' scaling consistent across views. Used by pScale and mScale. For example,
color
[ mName "popularity"
, mQuant
, mScale [ scDomain (doNums [ 0, 100 ]) ]
]Create a set of discrete domain to range mappings suitable for customising categorical
scales. The first item in each tuple should be a domain value and the second the
range value with which it should be associated. It is a convenience function equivalent
to specifying separate scDomain and scRange lists and is safer as it guarantees
a one-to-one correspondence between domain and range values. This is typically used
to provide discrete colors for categorical variables.
color
[ mName "weather"
, mNominal
, categoricalDomainMap
[ ( "sun", "yellow" )
, ( "rain", "blue" )
, ( "fog", "grey" )
]
|> mScale
]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. Convenience function equivalent to specifying separate scDomain and
scRange lists and is safer as it guarantees a one-to-one correspondence between
domain and range values.
color
[ mName "year"
, mOrdinal
, mScale (domainRangeMap ( 1955, "#e6959c" ) ( 2000, "#911a24" ))
]Numeric values that define a scDomain.
Set the midpoint of continuous two-point diverging domain. Useful when the domain is not symmetric about the given midpoint but you wish to use a color scheme that diverges equally from that point. Used by scDomain.
String values that define a scDomain.
Date-time values that define a scDomain.
Expression that should evaluate to a list of date-times that define a scDomain.
Set the minimum value of a date-time domain with an expression that evaluates to a date-time. Used by scDomain.
Set the maximum value of a date-time domain with an expression that evaluates to a date-time. Used by scDomain.
Convert from Elm's Time.Posix to a DateTime. Helpful when using Elm's typesafe time processing functions as input into Vega-Lite functions that require data-times. For example,
myTime : Time.Posix
myTime = ...
enc =
encoding
<< position X
[ pName "dt"
, pTemporal
, pScale [ scDomain <| doMinDt <| fromPosixTime myTime ]
]Indicate that a domain of aggregated data should be scaled to the domain of the data prior to aggregation. Used by scDomain.
Combine the given domain with that determined by the data. This allows a minimal domain to be set that may be exceeded if the data determine so. For example, the following sets a domain of at least 0 to 100, but can be exceeded if the data extend beyond the domain:
pScale [ scDomain (doUnionWith (doNums [ 0, 100 ])) ]Scale domain based on a named interactive selection. This can be used when projecting a selection across a single domain or equally across several domains. Used by scDomain.
Scale domain based on a named interactive selection (first parameter) and project it across the given channel (second parameter). Useful when, for example, you wish to project a 2d interval selection across the X and Y channels each with independent domains. Used by scDomain.
Scale domain based on a named interactive selection (first parameter) and project it across the given field (second parameter). Useful when, for example, you wish to project a 2d interval selection across the X and Y channels each with independent domains. Used by scDomain.
Describes the values after data have been encoded (e.g. pixel positions or color values).
Provide an expression to a range scale property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. Used by scRange. For example,
ps =
params
<< param "right"
[ paValue (num 0)
, paBind (ipRange [ inMax 500 ])
]
enc =
encoding
<< position X
[ pName "x"
, pScale [ scRange (raNumExpr "right" raMax) ]
]Provide a custom range of an encoding scaling. In contrast to the domain (data), the range describes the values after they have been encoded. For example, when encoding some data as size, the range will be in squared pixel units; when encoding with color, the range will be some colour values. Used by pScale and mScale.
For example, to set the size range of proportional symbols to be between 0 and 1000 squared pixels:
size
[ mName "magnitude"
, mQuant
, mScale [ scRange (raNums [ 0, 1000 ]) ]
]A list of expressions that each evaluate to an element of a scale range. Used by scRange. For example to set a positional range based on two sliders:
ps =
params
<< param "xMin"
[ paValue (num 0)
, paBind (ipRange [ inMin 0, inMax 400 ])
]
<< param "xMax"
[ paValue (num 400)
, paBind (ipRange [ inMin 0, inMax 400 ])
]
enc =
encoding
<< position X
[ pName "x"
, pScale [ scRange (raExprs [ "xMin", "xMax" ]) ]
]Name of a pre-defined scale range (e.g. symbol or diverging). Used by scRange.
Numeric scale range. Depending on the scaling this may be a [min, max] pair, or a list of explicit numerical values. Used by scRange.
Scale range comprising numeric lists. Useful, for example, when defining custom dash styles for a strokeDash channel encoding. Used by scRange.
Text scale range for discrete scales. Used by scRange.
Specify the field that contains explicit range values. This should be a one-to-one match with the field of domain values. Can be used, for example, to set color values explicitly from a data source. Used by scRange.
Color scheme used by a color scaling with mScale. The first parameter is the name of the scheme (e.g. "viridis"). For a full list of supported color scheme names, see the Vega documentation. The second parameter is an optional specification of the number of colors to use (list of one number), or the extent of the color range to use (list of two numbers between 0 and 1). Used by pScale and mScale.
color
[ mName "value"
, mOrdinal
, mScale [ scScheme "redblue" [ 0, 0.8 ] ]
]Expression that evaluates to a color scheme for color scaling. The first parameter is the expression and the second as for scScheme. Used by pScale and mScale. For example, to choose from a pair of preset schemes:
ps =
params
<< param "clrs"
[ paValue (str "plasma")
, paBind (ipSelect [ inOptions [ "plasma", "oranges" ] ])
]
enc =
encoding
<< color [ mName "val", mScale [ scSchemeExpr "clrs" [] ] ]Can be used to specify a custom interpolated colour scheme by providing a list of colours as a parameter value:
ps =
params
<< param "myScheme" [ paValues (strs [ "blue", "white", "red" ]) ]
enc =
encoding
<< color [ mName "val", mScale [ scSchemeExpr "myScheme" [] ] ]An ordinal band scale. Used when specifying a scType.
A symmetrical log scale used when specifying a scType. Similar to a log scale but supports zero and negative values. The slope of the function at zero can be set with scConstant.
A power scale used when specifying a scType. The exponent to use for scaling is specified with scExponent.
A quantile scale. Used when specifying a scType.
A quantizing scale. Used when specifying a scType.
A threshold scale. Used when specifying a scType.
Enable nice scaling. Used by scNice and axTickCount.
Disable nice scaling. Used by scNice and axTickCount.
Nice time intervals that try to align with rounded milliseconds. Used by scNice and axTickCount.
Nice time intervals that try to align with whole or rounded seconds. Used by scNice and axTickCount.
Nice time intervals that try to align with whole or rounded minutes. Used by scNice and axTickCount.
Nice time intervals that try to align with whole or rounded hours. Used by scNice and axTickCount.
Nice time intervals that try to align with whole or rounded days. Used by scNice and axTickCount.
Nice time intervals that try to align with whole or rounded weeks. Used by scNice and axTickCount.
Nice time intervals that try to align with whole or rounded months. Used by scNice and axTickCount.
Nice time intervals that try to align with whole or rounded years. Used by scNice and axTickCount.
Desired number of tick marks in a 'nice' scaling. Used by scNice and axTickCount.
'Nice' temporal interval values when scaling. Used by scNice and axTickCount.
Specify nice scaling with an expression that evaluates to a valid nice property (e.g. a number or time interval). Used by scNice and axTickCount.
For color interpolation types, see the Vega-Lite continuous scale documentation.
Cube helix color interpolation for continuous color scales using the given gamma value (anchored at 1). Used by scInterpolate.
Long-path cube helix color interpolation for continuous color scales using the given gamma value (anchored at 1). Used by scInterpolate.
HCL color interpolation for continuous color scales.
HCL color interpolation in polar coordinate space for continuous color scales.
HSL color interpolation for continuous color scales.
HSL color interpolation in polar coordinate space for continuous color scales.
Lab color interpolation for continuous color scales.
RGB color interpolation for continuous color scales using the given gamma value (anchored at 1). Used by scInterpolate.
Views can be combined to create more complex multi-view displays. This may involve
layering views on top of each other (superposition) or laying them out in adjacent
spaces (juxtaposition using repeatFlow, repeat,
facetFlow, facet, concat, hConcat
or vConcat). Where different views have potentially conflicting channels
(e.g. two position scales in a layered visualization) the rules for resolving them
can be defined with resolve. For details, see the
Vega-Lite composition documentation
Assign a list of specifications to superposed layers in a visualization. For example, adding text annotations to a bar chart:
let
data =
dataFromColumns []
<< dataColumn "x" (nums [ 1, 2, 3, 4, 5 ])
<< dataColumn "a" (nums [ 28, 91, 43, 55, 81 ])
enc =
encoding
<< position X [ pName "x", pOrdinal ]
<< position Y [ pName "a", pQuant ]
<< text [ tName "a", tNominal ]
in
toVegaLite
[ data []
, enc []
, layer
[ asSpec [ bar [] ]
, asSpec [ textMark [ maDy -8 ], enc [] ]
]
]Specifications to be juxtaposed in a flow layout of views. The number of columns in the flow layout can be set with columns and if not specified will default to a single row of unlimited columns.
let
data =
dataSequenceAs 0 6.28 0.1 "x"
trans =
transform
<< calculateAs "sin(datum.x)" "sinX"
<< calculateAs "cos(datum.x)" "cosX"
enc =
encoding
<< position X [ pName "x", pQuant ]
encCos =
enc << position Y [ pName "cosX", pQuant ]
encSin =
enc << position Y [ pName "sinX", pQuant ]
in
toVegaLite
[ data
, trans []
, concat
[ asSpec [ encCos [], line [] ]
, asSpec [ encSin [], line [] ]
]
]Maximum number of columns to include in a view composition flow layout. If the number of faceted small multiples exceeds this number, flow moves to the next row. Only applies to flow layouts generated by concat, facetFlow and repeatFlow. For example,
toVegaLite
[ data []
, columns 5
, specification mySpec
, facetFlow [ fName "myCategory" ]
]If 0, negative or not defined, faceted small multiples will be arranged in a single row.
Specifications to be juxtaposed horizontally in a column layout of views.
Juxtapose some specifications vertically in a row layout of views.
Alignment to apply to grid rows and columns generated by a composition operator. This version sets the same alignment for rows and columns.
Similar to align but with independent alignments for rows (first parameter) and columns (second parameter).
Subviews in a composed view to be aligned into a clean grid structure where all rows and columns are of the same size (based on maximum subview size). Used by align, alignRC, fAlign and lecoGridAlign.
Subviews in a composed view to be aligned into a clean grid structure where each row or column may be of variable size. Used by align, alignRC, fAlign and lecoGridAlign.
Flow layout is to be applied to composed views, in which adjacent subviews are placed one after the other. Used by align, alignRC, fAlign and lecoGridAlign.
Bounds calculation method to use for determining the extent of a sub-plot in
a composed view. If set to Full the entire calculated bounds including axes,
title and legend are used; if Flush only the width and height values for the
sub-view will be used. Used by bounds.
Bounds calculation should use the entire plot area (including axes, title, and legend).
Bounds calculation should take only the specified width and height values for a sub-view. Useful when attempting to place sub-plots without axes or legends into a uniform grid structure.
Spacing between sub-views in a composition operator. For example,
toVegaLite
[ data []
, spacing 40
, specification mySpec
, facet [ rowBy [ fName "row" ], columnBy [ fName "col" ] ]
]Similar to spacing but with independent spacing for rows (first parameter) and columns (second parameter).
Whether or not sub-views specified in a composition operator should be centred relative to their respective rows and columns.
Similar to center but with independent centring for rows and columns.
Controlling the (in)dependence between composed views. See the Vega-Lite resolve documentation.
Determine whether or not scales, axes or legends in composite views should share channel encodings.
let
data =
dataFromColumns []
<< dataColumn "x" (nums [ 1, 2, 3, 4, 5 ])
<< dataColumn "a" (nums [ 28, 91, 43, 55, 81 ])
<< dataColumn "b" (nums [ 17, 22, 28, 30, 40 ])
encBar =
encoding
<< position X [ pName "x", pQuant ]
<< position Y [ pName "a", pQuant ]
specBar =
asSpec [ bar [], encBar [] ]
encLine =
encoding
<< position X [ pName "x", pQuant ]
<< position Y [ pName "b", pQuant ]
specLine =
asSpec [ line [ maColor "firebrick" ], encLine [] ]
res =
resolve
<< resolution (reScale [ ( chY, reIndependent ) ])
in
toVegaLite [ data [], res [], layer [ specBar, specLine ] ]Define a resolution option to be applied when scales, axes or legends in composite views share channel encodings. For example, it allows different color scales to be used in a layered view, or different axis scales to be used in a faceted view. 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.
resolve
<< resolution (reScale [ ( chY, reIndependent ) ])
<< resolution (reScale [ ( chColor, reIndependent ) ])
<< resolution (reLegend [ ( chShape, reShared ) ])When specifying a resolution, indicates that a channel should be independent of others in a composite visualization.
Indicate how a channel's axes should be resolved when defined in more than one view in a composite visualization.
Indicate how a channel's legends should be resolved when defined in more than one view in a composite visualization.
Indicate how a channel's scales should be resolved when defined in more than one view in a composite visualization.
Reference to whatever is being encoded on the X channel. Can be used in the projection of interactive selections or in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the Y channel. Can be used in the projection of interactive selections or in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the X2 channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the Y2 channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the XOffset channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the Y offset channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the color channel. Can be used in the projection of interactive selections or in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the opacity channel. Can be used in the projection of interactive selections or in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the shape channel. Can be used in the projection of interactive selections or in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the size channel. Can be used in the projection of interactive selections or in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
Reference to whatever is being encoded on the stroke dash channel. Can be used in the projection of interactive selections or in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.
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. See the Vega-Lite facet documentation
Define the fields that will be used to compose a flow layout of a set of
small multiples. Used when the encoding 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.
Small multiples will be laid out from left to right, moving on to new rows only if the number of plots exceeds an optional column limit (specified via columns).
spec = asSpec [...]
toVegaLite
[ repeatFlow [ "Cat", "Dog", "Fish" ]
, specification spec
]Define the fields that will be used to make a composite view from multiple fields. Similar to repeatFlow except that the fields for repetition are explicitly allocated to rows, columns or layers.
Unlike faceting, which creates multiple charts based on different values of a single field, repeating uses a different field for each chart.
spec = asSpec [...]
toVegaLite
[ repeat [ columnFields [ "Cat", "Dog", "Fish" ] ]
, specification spec
]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. Used by repeat.
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. Used by repeat.
Create a list of fields to use in set of repeated layers. The list of fields
named here can be referenced in an encoding with pRepeat layer, mRepeat layer etc.
Used by repeat.
Facet a view to create small multiples in a flow layout. Used when 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.
Small multiples will be laid out from left to right, moving on to new rows only if the number of plots exceeds an optional column limit (specified via columns).
spec = ...
toVegaLite
[ facetFlow [ fName "Origin", fNominal ]
, specification spec
]Facet a view to create a grid of small multiples. Similar to facetFlow except that the fields for faceting by rows and by columns are set explicitly.
spec = ...
toVegaLite
[ facet [ rowBy [ fName "month", fOrdinal ]
, columnBy [ fName "week", fOrdinal ]
]
, specification spec
]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. For repeated and faceted specs, the entire specification is provided.
Define a specification object for use with faceted and repeated small multiples.
spec = ...
toVegaLite
[ facet [ rowBy [ fName "Origin", fNominal ] ]
, specification spec
]Layer arrangement in a repeated view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.
Flow arrangement in a repeated/faceted view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.
Column arrangement in a repeated/faceted view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.
Row arrangement in a repeated/faceted view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.
Provide an expression to a facet header property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. Used by fHeader and coHeader.
For example,
ps =
params
<< param "size"
[ paValue (num 12)
, paBind (ipRange [ inMax 32 ])
]
enc =
encoding
<< column
[ fName "country"
, fHeader [ hdNumExpr "size" hdLabelFontSize ]
]Provide an expression to a facet header property function requiring a string value. This can be used to provide an interactive parameterisation of a header property when an expression is bound to an input element. Used by fHeader and coHeader. For example,
ps =
params
<< param "color"
[ paValue (str "black")
, paBind (ipColor [])
]
enc =
encoding
<< column
[ fName "country"
, fHeader [ hdStrExpr "color" hdLabelColor ]
]Expression for customising
header labels. Can reference datum.value and datum.label for access to the
underlying data values and label text respectively. Used by fHeader
and coHeader.
The relative position of both a header label and title relative to a sub-plot (shortcut instead of specifying hdLabelOrient and hdTitleOrient separately). Used by fHeader and coHeader.
Formatting pattern for facet header (title) values. To distinguish between formatting as numeric values and data/time values, additionally use hdFormatAsNum, hdFormatAsTemporal or hdFormatAsCustom. Used by fHeader and coHeader.
Indicate that facet headers should be formatted as numbers. To control the precise numeric format, additionally use hdFormat providing a d3 numeric format string. Used by fHeader and coHeader.
Indicate that facet headers should be formatted as dates/times. To control the precise temporal format, additionally use hdFormat providing a d3 date/time format string. Used by fHeader and coHeader.
Indicate that facet headers should be formatted with a registered custom formatter with the given name. See how to register a Vega-Lite custom formatter. Used by fHeader and coHeader.
Vega-Lite parameters allow named objects whose values can change to persist within a specification. In the case of simple variables, it is often easier to use Elm directly to store persistent values. The main benefits of parameters are for storing interaction selections such as mouse selections or slider values. See the Vega-Lite parameter documentation for details.
Specify top-level parameters to be used within a specification. While literals
may be specified as parameters, these are better handled directly in Elm. More
useful expression parameters are those that use the
vega-lite built-in parameters
width, height, padding, autosize, background and cursor. For example
to keep text size a fixed proportion of the plot height:
ps =
params
<< param "textSize" [ paExpr "height/20" ]Also useful is the ability to bind parameters to input elements such as range
sliders that may be updated at runtime. For example the value of the radius parameter
is determined by the slider position and then used as a mark property to alter
circle size dynamically:
let
ps =
params
<< param "radius"
[ paValue (num 0)
, paBind (ipRange [ inMax 100 ])
]
enc =
encoding
<< position Theta [ pName "value", pQuant ]
<< color [ mName "category" ]
in
toVegaLite
[ ps []
, data []
, enc []
, arc [ maNumExpr "radius" maInnerRadius ]
]Add a named parameter to a list of parameters. A parameter should have a name and a list of parameter details. For example,
param "mySelection" [ paSelect seInterval [] ]Provide an initial value of a parameter. This can be useful, for example, when setting the initial value of an interaction parameter:
ps =
params
<< param "quarterSelection"
[ paValue (num 3)
, paSelect sePoint [ seFields [ "quarter" ] ]
, paBind (ipRange [ inMin 1, inMax 4, inStep 1 ])
]If the value of a selection parameter needs to be explicitly referenced, such as in a data filtering operation, the parameter value can be initialised with a named tuple. Used by param. For example, to filter data between two interactive slider values:
ps =
params
<< param "minSlider"
[ paSelect sePoint []
, paValue (dataObject [ ( "minVal", num 0 ) ])
, paBind (ipRange [ inMin 0, inMax 50 ])
]
<< param "maxSlider"
[ paSelect sePoint []
, paValue (dataObject [ ( "maxVal", num 100 ) ])
, paBind (ipRange [ inMin 50, inMax 100 ])
]
trans =
transform
<< filter (fiExpr "datum.x >= minSlider_minVal && maxSlider_maxVal >= datum.x")Initial set of values of a parameter. Useful for passing to functions that require a list of values. Used by param. For example, to allow filtering by two separate data values:
ps =
params
<< param "CylYr"
[ paSelect sePoint [ seFields [ "Cylinders", "Year" ] ]
, paValues (dataObjects [ [ ( "Cylinders", num 4 ), ( "Year", num 1977 ) ] ])
, paBindings
[ ( "Cylinders", ipRange [ inMin 3, inMax 8, inStep 1 ] )
, ( "Year", ipRange [ inMin 1969, inMax 1981, inStep 1 ] )
]
]Initial value of a parameter specified as a Vega expression. Used by param. For example,
ps =
params
<< param "cx" [ paExpr "width/2" ]
<< param "cy" [ paExpr "height/2" ]Specify a selection parameter to be used for interaction. Used by param. For example, to create an interval selection:
param "mySelection" [ paSelect seInterval [] ]To project a point selection across the field encoded with colour:
param "mySelection" [ paSelect sePoint [ seEncodings [ chColor ] ] ]Indicate a draggable bounding rectangle can be made for selecting all items that intersect with it. Used by paSelect.
Vega event stream selector that can clear a selection. Used by paSelect. For example, to allow a zoomed/panned view to be reset on shift-click:
ps =
params
<< param "myZoomPan"
[ paSelect seInterval [ seClear "click[event.shiftKey]" ]
, paBindScales
]To remove the default clearing behaviour of a selection, provide an empty string rather than an event stream selector.
Encoding channels that form a named selection. For example, to project a selection across all items that share the same value in the color channel. Used by paSelect. For example,
ps =
params
<< param "sel" [ paSelect sePoint [ seEncodings [ chColor ] ] ]Field names for projecting a selection over multiple fields. Used by paSelect.
Whether or not a selection should capture nearest marks to a pointer rather than an exact position match. Used by paSelect.
Vega event stream selector that triggers a selection. Used by paSelect. For example, to create a paintbrush effect under the pointer:
ps =
params
<< param "paint" [ paSelect sePoint [ seOn "mouseover" ] ]Predicate expression that determines a toggled selection. See the Vega-Lite toggle documentation. Used by paSelect.
For example, to create a paintbrush type effect that leaves a trail of selections under the pointer while the shift key is pressed down:
ps =
params
<< param "paint"
[ paSelect sePoint [ seOn "mouseover", seToggle tpShiftKey ] ]Specify that data values in a selection are never unselected when interacted with on multiple occasions. This allows a single selected item to be guaranteed. Used by seToggle.
Specify that repeated selections are toggled when the given expression evaluates to true. Used by seToggle. This allows, for example, multiple key modifiers to generate toggling:
ps =
params
<< param "paint"
[ paSelect sePoint
[ seOn "mouseover"
, seToggle (tpExpr "event.shiftKey && event.ctrlKey")
]
]Specify that data values in a selection are toggled when interacted with on multiple occasions while the shift key is held down. This is the default behaviour so should only be needed if moving back from some other specified behavior. Used by seToggle.
Specify that data values in a selection are toggled when interacted with on multiple occasions while the alt key is held down. Used by seToggle.
Specify that data values in a selection are toggled when interacted with on multiple occasions while the control key is held down. Used by seToggle.
Interaction event stream for translating an interval selection. If an empty string, selection translation will be disabled. See the Vega-Lite zoom documentation. Used by paSelect.
Interaction event stream for zooming an interval selection. If an empty string, zooming will be disabled. See the Vega-Lite zoom documentation. Used by paSelect.
The dynamic binding associated with a parameter. Can be used to create a parameter value that varies as an interactive input control (e.g. slider) is updated. Used by param. For example,
param "mySlider"
[ paSelect sePoint []
, paBind (ipRange [ inMin 1, inMax 10 ])
]For details see the Vega-Lite binding documentation
One or more named dynamic bindings associated with a parameter. Unlike paBind, this allows multiple input elements to be bound to the same field. Used by param. For example, to bind a selection to the 'And' selection of two sliders:
param "CylYr"
[ paSelect sePoint [ seFields [ "Cylinders", "Year" ] ]
, paBindings
[ ( "Cylinders", ipRange [ inMin 3, inMax 8, inStep 1 ] )
, ( "Year", ipRange [ inMin 1969, inMax 1981, inStep 1 ] )
]
]Bind a named parameter selection to the scales of a view to allow interactive zooming and panning. For example,
ps =
params
<< param "zoomer" [ paSelect seInterval [], paBindScales ]Bind a named parameter selection to a legend for interactive selection of field values from a legend. Can be bound to a field or channel. For example the following will bind a color legend to a point selection allowing filtering or highlighting by the selected value that has been encoded with color.
ps =
params
<< param "legSel"
[ paSelect sePoint [ seEncodings [ chColor ] ]
, paBindLegend ""
]To customise which events should trigger legend interaction, provide a Vega event stream string. If an empty string is provided, the default single-click interaction is used. Used by param.
For example, to allow legend selection with a double click:
paBindLegend "dblClick"or with shift-click:
paBindLegend "click[event.shiftKey]"Range slider input element that can bound to a named parameter. Used by paBind.
Checkbox input element that can bound to a named parameter. Used by paBind.
Radio box input element that can bound to a named parameter. Used by paBind.
Select input element that can bound to a named parameter. Used by paBind.
Text input element that can bound to a named parameter. Used by paBind.
Number input element that can bound to a named parameter. Used by paBind.
Date input element that can bound to a named parameter. Used by paBind.
Time input element that can bound to a named parameter. Used by paBind.
Month input element that can bound to a named parameter. Used by paBind.
Week input element that can bound to a named parameter. Used by paBind.
Local time input element that can bound to a named parameter. Used by paBind.
Telephone number input element that can bound to a named parameter. Used by paBind.
Color input element that can bound to a named parameter. Used by paBind.
Delay to introduce when processing input events in order to avoid unnecessary event broadcasting. Used by input elements such as ipRange and ipCheckbox.
CSS selector indicating the parent element to which an input element should be added. Allows the option of the input element to be outside the visualization container. Used by input elements such as ipRange and ipCheckbox.
Options for a ipRadio or ipSelect input element. Assumes all options are strings. For other types, consider inDatumOptions or inDataOptions.
Options for a ipRadio or ipSelect input element. Similar to inDatumOptions except that each option can be a list of data values. For example,
ipRadio [ inDataOptions [ nums [ 2, 3, 5, 7, 11, 13 ], boos [ True, False ] ] ]Minimum slider value for a ipRange input element.
Maximum slider value for a ipRange input element.
Smallest ipRange slider increment.
Initial place-holding text for input elements such as ipText fields.
### Selection Marks
Customising the appearance of interval selection rectangles.
Appearance of an interval selection mark (dragged rectangle). Used by paSelect.
Fill color of an interval selection mark (dragged rectangular area). Used by seSelectionMark.
Fill opacity of an interval selection mark in the range 0 to 1. Used by seSelectionMark.
Stroke color of an interval selection mark. Used by seSelectionMark.
Stroke dash style of an interval selection mark. Used by seSelectionMark.
Stroke dash offset of an interval selection mark. Used by seSelectionMark.
Stroke opacity of an interval selection mark in the range 0 to 1. Used by seSelectionMark.
Stroke width of an interval selection mark. Used by seSelectionMark.
Cursor type to appear when pointer is over an interval selection mark (dragged rectangular area). Used by seSelectionMark.
Determines how selections are made across multiple views. See the Vega-lite resolve selection documentation.
Strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain. Used by paSelect.
One selection available across all subviews (default). Used by seResolve.
Each subview contains its own brush and marks are selected if they lie within any of these individual selections. Used by seResolve.
Each subview contains its own brush and marks are selected if they lie within all of these individual selections. Used by seResolve.
Channel encoding can be made conditional on a parameter value, therefore allowing it to be the result of some interaction or data expression. It does this via mCondition (and its 'o', 't' and 'h' variants). Mark appearance can therefore depend on some properties such as whether a datum is null or whether it has been interactively selected. The condition to test (predicate) is usually specified either as a parameter with prParam or an expression with prTest.
Make a mark channel encoding conditional on a predicate expression. A predicate might be the result of evaluating a parameter (prParam) or an expression (prTest). The first parameter is the predicate that evaluates to true or false; the second the encoding if true, the third the encoding if false. Used by functions that influence mark channels such as size and color.
For example, to encode in one of two colours depending on a selection:
encoding
<< color
[ mCondition (prParam "mySelection")
[ mStr "red" ]
[ mStr "black" ]
]Make a mark channel conditional on a sequence of predicate values. This can be used when several predicates need to be tested in sequence each with their own encoding outcome ('if-else'). Used by functions that influence mark channels such as size and color.
For example, a four-way conditional color encoding can be specified as:
encoding
<< color
[ mConditions
[ ( prTest (expr "datum.value < 40"), [ mStr "blue" ] )
, ( prTest (expr "datum.value < 50"), [ mStr "red" ] )
, ( prTest (expr "datum.value < 60"), [ mStr "yellow" ] )
]
[ mStr "black" ]
]Make an order channel encoding conditional on a predicate expression. A predicate might be the result of evaluating a parameter (prParam) or an expression (prTest). The first parameter is the predicate that evaluates to true or false; the second the encoding if true, the third the encoding if false. Used by order and oCondition.
For example, to bring marks of an interactively selected colour to the front:
ps =
params
<< param "sel" [ paSelect sePoint [ seEncodings [ chColor ] ] ]
enc =
encoding
<< order [ oCondition (prParam "sel") [ oNum 1 ] [ oNum 0 ] ]Make an order channel conditional on a sequence of predicate values. This can be used when several predicates need to be tested in sequence each with their own encoding outcomes ('if-else'). Used by order and oCondition.
For example to control mark z-order for three category values:
order
[ oConditions
[ ( prTest (expr "datum.Origin == 'Europe'"), [ oNum 3 ] )
, ( prTest (expr "datum.Origin == 'Japan'"), [ oNum 2 ] )
]
[ oNum 1 ]
]Make a text channel encoding conditional on a predicate expression. A predicate might be the result of evaluating a parameter (prParam) or an expression (prTest). The first parameter is the predicate that evaluates to true or false; the second the encoding if true, the third the encoding if false. Used by text and tooltip.
Make a hyperlink channel encoding conditional on a predicate expression. A predicate might be the result of evaluating a parameter (prParam) or an expression (prTest). The first parameter is the predicate that evaluates to true or false; the second the encoding if true, the third the encoding if false. Used by hyperlink and url.
Parameter name that should evaluate to either true or false for use in functions that use predicates, such as mCondition, oCondition and tCondition.
Parameter name that should evaluate to either true or false for use in selections for conditional encoding. Same as prParam except that an empty selection is assumed to be false. Used by mCondition, oCondition and tCondition.
Test that should evaluate to either true or false for use in functions that use predicates, such as mCondition, oCondition and tCondition.
Treat a parameter as a boolean expression that may be composed to form more
complex boolean expressions. Can be used when composing selections from multiple
parameters. Used by prTest, fiCompose,
axDataCondition, and, or and not.
For example, if we have two interval selection parameters alex and
morgan we can conditionally colour if both selections intersect.
color
[ mCondition (prTest (and (bParam "alex") (bParam "morgan")))
[ mStr "red" ]
[ mStr "gray" ]
]Expression that should evaluate to either true or false. Can use any valid Vega expression. Used by prTest, fiCompose, axDataCondition, and, or and not.
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.
Apply a negation Boolean operation as part of a logical composition. Boolean operations can be nested to any level.
not (and (expr "datum.IMDB_Rating === null") (expr "datum.Rotten_Tomatoes_Rating === null"))These are in addition to the data and transform options described above. See the Vega-Lite top-level spec documentation
Name to be associated with a visualization.
Description to be associated with a visualization.
Override the default height of the visualization. If not specified the height will be calculated based on the content of the visualization. How the content is sized relative to this height specification can be customised with autosize.
Set the height of the view to be that of the surrounding container. Allows responsive sizing to be specified.
Override the default width of the visualization in pixel units. If not specified, the width will be calculated based on the content of the visualization.
toVegaLite [ width 540, data [], enc [], bar [] ]How the content is sized relative to this width specification can be customised with autosize.
Set the width of the view to be that of the surrounding container. Allows responsive sizing to be specified.
Set the width of the discrete x-field (e.g. individual bars in a bar chart). The total width is then calculated based on the number of discrete fields (e.g. bars).
toVegaLite [ widthStep 17, data [], enc [], bar [] ]Set the width of the offset-grouped discrete x-fields. The total width is then
calculated based on the number of offset discrete fields (e.g. groups of bars with
position XOffset applied).
Set the height of the discrete y-field (e.g. individual bars in a horizontal bar chart). The total height is then calculated based on the number of discrete fields (e.g. bars).
toVegaLite [ heightStep 17, data [], enc [], bar [] ]Set the height of the offset-grouped discrete y-fields. The total height is then
calculated based on the number of offset discrete fields (e.g. groups of bars with
position YOffset applied).
Padding around the visualization in pixel units. The way padding is interpreted
will depend on the autosize properties.
Provide an expression to a padding property function requiring a numeric value such as paSize. Used by padding and coPadding. For example,
let
ps =
params
<< param "pd"
[ paValue (num 0)
, paBind (ipRange [ inName "padding", inMax 100 ])
]
...
in
toVegaLite
[ ps []
, width 300
, height 300
, autosize [ asFit ]
, padding (paSize |> paNumExpr "pd")
...
]Expressions that each evaluate to a numeric values indicating padding around a visualization in pixel units. The four parameters refer to left, top, right and bottom edges respectively. Can be useful when padding is to be determined interactively through input elements. Used by padding and coPadding.
Declare the way the view is sized. See the Vega-Lite autosize documentation.
enc = ...
toVegaLite
[ width 250
, height 300
, autosize [ asFit, asPadding, asResize ]
, dataFromUrl "data/population.json" []
, bar []
, enc []
]Interpret visualization dimensions to be for the data rectangle (external padding added to this size). Used by autosize and coAutosize.
Interpret visualization dimensions to be for the entire visualization (data rectangle is shrunk to accommodate external decorations padding). Used by autosize and coAutosize.
Interpret visualization width to be for the entire visualization width (data rectangle width is shrunk to accommodate external decorations padding). Used by autosize and coAutosize.
Interpret visualization height to be for the entire visualization height (data rectangle height is shrunk to accommodate external decorations padding). Used by autosize and coAutosize.
No autosizing to be applied. Used by autosize and coAutosize.
Automatically expand size of visualization from the given dimensions in order to fit in all supplementary decorations (legends etc.). Used by autosize and coAutosize.
Interpret visualization width to be for the entire visualization (data rectangle is shrunk to accommodate external padding). Used by autosize and coAutosize.
Recalculate autosizing on every view update. Used by autosize and coAutosize.
Background color of the entire visualization. For view compositions, single
views or layers can have their own background styles in addition to this global
background color. Should be specified with a CSS string such as #ffe or
rgb(200,20,150). If not specified the background will be white.
Expression that evaluates to a colour used for the visualization background. Useful when the colour is to be determined at runtime though an interaction element such as ipColor. For example,
let
ps =
params
<< param "clr" [ paValue (str "white"), paBind (ipColor []) ]
in
toVegaLite [ ps [], backgroundExpr "clr" ]Add custom metadata to a specification. While these are ignored by Vega-Lite, this can be useful for cusstom implementations that require addtional metadata. The parameter should be a series of named key-value pairs that will be stored in the specification as a JavaScript object. For example,
userMeta
[ ( "Custom1", num 13 )
, ( "Custom2", str "hello" )
, ( "Custom3", datumArray ([ 1, 2, 3, 4 ] |> List.map num) )
, ( "Custom4", dataObject [ ( "nested1", num 14 ), ( "nested2", boo True ) ] )
, ( "Custom5", nullValue )
]Per-title settings. To standardize the appearance of all titles in a multi-view specification, use coTitle instead.
Provide an expression to a title property function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. For example,
ps =
params
<< param "fs"
[ paValue (num 0)
, paBind (ipRange [ inMax 32 ])
]
ttl =
title "My title" [ tiNumExpr "fs" tiFontSize ]Provide an expression to a title configuration function requiring a numeric value. Used by coTitle.
Provide an expression to a title property function requiring a string value. This can be used to provide an interactive parameterisation of a title property when an expression is bound to an input element. For example,
ps =
params
<< params "clr"
[ paValue (str "black")
, paBind (ipColor [])
]
ttl =
title "My title" [ tiStrExpr "clr" tiColor ]Provide an expression to a title configuration function requiring a string value. Used by coTitle.
Title to be displayed for a plot. The first parameter is the text of the title,
the second a list of any title properties to configure its appearance. To display
a title over more than one line, insert \n at each line break or use a """
multi-line string.
title "First line\nSecond line" []or
title """First line
Second line""" []Expression that evaluates to a title. Similar to title except the content of the title is the evaluated expression (first parameter). For example,
let
ps =
params << param "ttl" [ paValue (num (2 * pi)) ]
in
toVegaLite [ titleExpr "ttl" [] ]Anchor position when placing a title.
Angle of title text (degrees from horizontal).
Vertical alignment of a title.
Text colour of a title.
Delta offset of title and subtitle x-position.
Delta offset of title and subtitle y-position.
title font.
title font size.
title font style (italic etc.).
title font weight.
Line height (vertical spacing) for title text.
Maximum length of the title display in pixel units.
Offset in pixel units of the title relative to the chart body.
Placement of title relative to the chart body.
A list of named styles to apply to title. A named style can be specified via coMarkStyles if more than one style is required. Later styles in the list will override earlier styles if there is a conflict in any of the mark properties specified.
While this is provided for compatibility with Vega-Lite style specification, for greater type safety in elm-vegalite, instead create functions that generate TitleProperties.
Drawing order of a title relative to the other chart elements. 1 indicates title is drawn in front of chart marks, 0 indicates it is drawn behind them.
The background of a single view in a view composition can be styled independently of other views. For more details see the Vega-Lite view background documentation
The background style of a single view or layer in a view composition.
Provide an expression to a view background function requiring a numeric value. This can be used for interactive parameterisation when an expression is bound to an input element. For example,
ps =
params
<< param "r"
[ paValue (num 0)
, paBind (ipRange [ inMax 20 ])
]
bg =
viewBackground [ vbNumExpr "r" viewCornerRadius ]Provide an expression to a view background confguration function requiring a numeric value. Used by coView.
Provide an expression to a view background function requiring a list of numbers (for dash styles). This can be used to provide an interactive parameterisation of a view background dash property when an expression is bound to an input element. For example,
ps =
params
<< param "dashStyle"
[ paValue (nums [ 2, 2 ])
, paBind (ipSelect [ inDataOptions [ nums [ 2, 2 ], nums [ 8, 8 ] ] ])
]
bg =
viewBackground [ vbNumsExpr "dashStyle" viewStrokeDash ]Used by viewBackground and vicoBackground.
Provide an expression to a view background configuration function requiring a list of numbers (for dash styles). Used by coView.
Provide an expression to
a view background function requiring a Maybe String value. This can be used to
provide an interactive parameterisation of a view background when an expression
is bound to an input element. For example,
ps =
params
<< param "clr"
[ paValue (str "white")
, paBind (ipColor [])
]
bg =
viewBackground [ vbStrExpr "clr" viewFill ]Used by viewBackground and vicoBackground.
Provide an expression to a
view background configuration function requiring a Maybe String value. Used by
coView.
Provide an expression to a view configuration function a Boolean value. Used by coView.
A list of named styles to apply to a single view background. A named style can be specified via coMarkStyles if more than one style is required. Later styles in the list will override earlier styles if there is a conflict in any of the mark properties specified. Used by viewBackground and vicoBackground.
The radius in pixels of rounded corners in single view or layer background. Used by viewBackground and vicoBackground.
Fill color for a single view or layer background. Used by viewBackground and vicoBackground.
Fill opacity for a single view or layer background. Used by viewBackground and vicoBackground.
Overall opacity for a single view or layer background. Used by viewBackground and vicoBackground.
Stroke color for line around a single view or layer background. If Nothing
is provided, no strokes are drawn around the view. Used by
viewBackground and vicoBackground.
Stroke cap line-ending around a single view or layer background. Used by viewBackground and vicoBackground.
Stroke dash style for a line around a single view or layer background. Used by viewBackground and vicoBackground.
Stroke dash offset for line around a single view or layer background. Used by viewBackground and vicoBackground.
Stroke line-joining style around a single view or layer background. Used by viewBackground and vicoBackground.
Stroke mitre limit at which to bevel a line join around a single view or layer background. Used by viewBackground and vicoBackground.
Stroke opacity around a single view or layer background. Used by viewBackground and vicoBackground.
Stroke around a single view or layer background. Used by viewBackground and vicoBackground.
Allows default properties for most marks and guides to be set. See the Vega-Lite configuration documentation.
Create a single global configuration from a list of configuration specifications. Each configuration that makes up the global list of customisations refers to a specific part of all visualizations to which it is applied, such as axes, legends, selections etc. See the Vega-Lite documentation.
Individual configuration functions are prefixed with an abbreviation of the part
of the visualization to configure followed by co. For example, axis configuration
functions axco, legends leco, titles tico, faceting faco etc.
The following makes all axis lines (domain) 2 pixels wide, removes the border rectangle and requires interactive selection of items to use a double-click.
let
cfg =
configure
<< configuration (coAxis [ axcoDomainWidth 2 ])
<< configuration (coView [ vicoStroke Nothing ])
<< configuration (coSelection [ ( sePoint, [ seOn "dblclick" ] ) ])
in
toVegaLite [ cfg [], data [], enc [], bar [] ]A configuration option to be applied globally across the visualization.
Provide an expression to a top-level configuration function requiring a Boolean value. This can be used to provide an interactive parameterisation when an expression is bound to an input element. Used by configuration, coAxisXFilter and coAxisYFilter.
Provide an expression to a top-level configuration function requiring a string value. This can be used to provide an interactive parameterisation when an expression is bound to an input element. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of area marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Whether or not ARIA attributes
should be included for marks and guides when generating SVG output. If not specified,
the default is True. Used by configuration, coAxisXFilter
and coAxisYFilter.
Configure the default sizing of visualizations. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of axes. Used by configuration, coAxisXFilter and coAxisYFilter.
Filter an axis configuration so that it only applies to x-axes. For example, to configure all band X-axes to be red:
configuration (coAxisBand [ axcoTitleColor "red" ] |> coAxisXFilter)Filter an axis configuration so that it only applies to y-axes. For example, to configure all temporal Y-axes to be red:
configuration (coAxisTemporal [ axcoTitleColor "red" ] |> coAxisYFilter)Configure the default appearance of left-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of right-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of top-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of bottom-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of any axes using a band (binned) scale. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of any axes using a discrete scale. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of any axes using a point scale. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of any quantitative axes. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of any temporal axes. Used by configuration, coAxisXFilter and coAxisYFilter.
Specify a list of named styles that each define a list of axis properties. Provided for compatibility with Vega-Lite, but generally greater type safety is achieved in elm-vegalite by creating elm functions that generate lists of AxisProperties. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default background color of visualizations. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of bar marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of circle marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of concatenated layouts. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default title style for count fields. Used by configuration, coAxisXFilter and coAxisYFilter.
Determine whether formatting of text marks and guides (e.g. axFormatAsCustom) will accept a custom formatter function. If true, the custom formatter should be registered as a Vega expression. Used by configuration, coAxisXFilter and coAxisYFilter.
For example, registering the JavaScript function
vega.expressionFunction('unitFormat', function (datum, params) {
const dp = params.match(/\d+/)[0];
const unit = params.replace(dp, '');
return datum.toFixed(dp) + unit;
});And enabling custom formatting within
cfg =
configure
<< configuration (coCustomFormatTypes True)Allows custom axis formatting such as the following to display units to 2 decimal places followed by an 'm'
pAxis
[ axTitle "Flipper length"
, axFormatAsCustom "unitFormat"
, axFormat "2m"
]Configure the default title generation style for fields. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default font for all titles, labels and text marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of geoshape marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of facet layouts. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of facet headers. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of legends. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of line marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Specify the default locale settings. Allows, for example, local currency, time and thousands separators to be defined as the default. Used by configuration, coAxisXFilter and coAxisYFilter. For example a German locale might be defined as the following which uses a comma for decimal symbol, a point as a thousands separator and a default Euro symbol with non-breaking space for currency:
cfg =
configure
<< configuration
(coLocale
[ loDecimal ","
, loThousands "."
, loGrouping 3
, loCurrency "" "\u{00A0}€"
]
)Configure the default mark appearance. Used by configuration, coAxisXFilter and coAxisYFilter.
Specify a list of named styles that each define a list of mark properties. Can be used when configuring views, titles etc. Used by configuration, coAxisXFilter and coAxisYFilter.
Provided for compatibility with Vega-Lite, but generally greater type safety is achieved in elm-vegalite by creating elm functions that generate lists of MarkProperties.
Configure the default number formatting for numeric output that appears in axis labels, legends and tooltips. Uses d3 format codes to set appearance of numbers. Used by configuration, coAxisXFilter and coAxisYFilter. For example, to display numeric values to 3 decimal places:
cfg =
configure
<< configuration (coNumberFormat ".3f")Provide the name of a registered custom formatter for numeric output that appears in axis labels, legends and tooltips. See coCustomFormatTypes for an example of how to register custom formatter. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default number formatting for normalized numeric output used by stacked charts. Uses d3 format codes to set appearance of numbers. Used by configuration, coAxisXFilter and coAxisYFilter.
Provide the name of a registered custom formatter for numeric output used by stacked charts. See coCustomFormatTypes for an example of how to register custom formatter. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default formatting of values shown in a tooltip. This allows tooltip-specific formatting that may be different to defaults or more global configuration of formatting. Used by configuration. For example, to set toolip numeric values to be 3 decimal places when non-tooltip values have been configured to whole numbers and to provide a custom time format for tooltips only:
cfg =
configure
<< configuration (coNumberFormat "d")
<< configuration (coTooltipFormat [ coNumberFormat ".3f", coTimeFormat "%b %y" ])Configure the default padding in pixels from the edge of the of visualization to the data rectangle. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of point marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default style of map projections. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default range properties used when scaling. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of rectangle marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of rule marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default scale properties used when scaling. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of selection marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of square marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of text marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default appearance of tick marks. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default style of visualization titles. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default time format for axis and legend labels. Used by configuration, coAxisXFilter and coAxisYFilter.
Provide the name of a registered custom formatter for temporal output that appears in axis labels, legends and tooltips. See coCustomFormatTypes for an example of how to register custom formatter. Used by configuration, coAxisXFilter and coAxisYFilter.
Configure the default style of trail marks.
Configure the default single view style. Used by configuration, coAxisXFilter and coAxisYFilter.
See the Vega-Lite axis config documentation.
Default ARIA properties for providing accessible SVG output associated with an axis. If an empty list is provided, ARIA tagging will be switched off. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis band position. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Whether or not axes are generated for positional encoding by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Whether or not an axis domain should be displayed by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default dash style of axis baseline (domain). The parameter should list number of pixels in alternating dash and gap lengths. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default number of pixels before the first axis baseline (domain) line dash is drawn. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default appearance of ends of axis domain. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis domain color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis domain opacity. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis domain width style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default maximum extent style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default minimum extent style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default coordinate space translation offset for axis layout. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Whether or not an axis grid is displayed by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default appearance of ends of grid lines. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis grid color style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis line dash style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default number of pixels before the first axis grid line dash is drawn. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis grid line opacity. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis grid line width. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Whether or not an axis has labels by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label horizontal alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label angle (degrees from horizontal). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label vertical alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label bounding when label exceeds available space. If Nothing,
no check for label size is made. A number specifies the permitted overflow in pixels.
Used by coAxis, coAxisLeft, coAxisRight, coAxisTop,
coAxisBottom, coAxisBand, coAxisDiscrete,
coAxisPoint, coAxisQuant and coAxisTemporal.
Expression that evaluates to True, False or a number depending whether,
by default, a check is to be made for an axis label size. A number specifies the
permitted overflow in pixels. Used by coAxis,
coAxisLeft, coAxisRight, coAxisTop,
coAxisBottom, coAxisBand, coAxisDiscrete,
coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default expression to generate axis labels. The parameter is a valid
Vega expression. Can reference
datum.value and datum.label for access to the underlying data values and
default label text respectively. Used by coAxis,
coAxisLeft, coAxisRight, coAxisTop,
coAxisBottom, coAxisBand, coAxisDiscrete,
coAxisPoint, coAxisQuant and coAxisTemporal.
Default label alignment at beginning or end of the axis. Specifies the distance
threshold from an end-point within which labels are flush-adjusted or if Nothing,
no flush-adjustment made. Used by coAxis,
coAxisLeft, coAxisRight, coAxisTop,
coAxisBottom, coAxisBand, coAxisDiscrete,
coAxisPoint, coAxisQuant and coAxisTemporal.
Default number of pixels by which to offset flush-adjusted labels. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label font. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label font size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label font style (e.g. "italic"). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label font weight. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label limit (how much a label can extend beyond the left/bottom or right/top of the axis line). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label line height (useful for multi-line labels). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis offset in pixels of an axis's labels relative to its ticks. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label opacity. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label overlap strategy for cases where labels cannot fit within the allotted space. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label padding (space between labels in pixels). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis label separation (minimum spacing between axis labels). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default offset between the axis and the edge of the enclosing group or data rectangle. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
A list of named styles to apply as defaults to axes. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Whether or not an axis should show ticks by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default alignment of grid lines and ticks in band scales. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis tick end cap style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis tick mark color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default number of, or interval between, axis ticks. The resulting number of ticks may be different so that values are “nice” (multiples of 2, 5, 10). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis tick dash style. The parameter is a list of alternating 'on' and 'off' lengths in pixels representing the dashed line. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default number of pixels before the first axis tick dash is drawn. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Whether or not by default an extra axis tick should be added for the initial position of axes. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default offset in pixels of axis ticks, labels and gridlines. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default opacity of axis ticks. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Whether or not axis tick labels use rounded values by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis tick mark size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
The minimum desired step between axis ticks, in terms of scale domain values.
For example, a value of 1 indicates that ticks should not be less than 1 unit
apart. If specified, the tick count value will be adjusted, if necessary, to
enforce the minimum step value. Used by coAxis,
coAxisLeft, coAxisRight, coAxisTop,
coAxisBottom, coAxisBand, coAxisDiscrete,
coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis tick mark width. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis tick label horizontal alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default anchor position of axis titles. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title angle (degrees from horizontal). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title vertical alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title font. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title font size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title font style (e.g. "italic"). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title font weight. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title maximum size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default line height for multi-line axis titles. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default opacity of axis titles. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis title padding between axis line and text. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis x-position relative to the axis group. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Default axis y-position relative to the axis group. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.
Used by coLegend to specify the default maximum height of legend entries.
Used by coLegend to specify the default horizontal padding between symbol legend entries.
Used by coLegend to specify the default number of columns in which to arrange symbol legend entries.
Used by coLegend to specify the default legend corner radius.
Used by coLegend to specify the default direction of a legend.
Used by coLegend to specify the whether or not legends should be disabled by default.
Used by coLegend to specify the default background legend color.
Used by coLegend to specify the default legend position relative to the main plot content.
Used by coLegend to specify the default offset in pixel units between the legend and the enclosing group or data rectangle.
Used by coLegend to specify the default legend border color.
Used by coLegend to specify the default legend border stroke dash style.
Used by coLegend to specify the default legend border stroke width.
Used by coLegend to specify the default spacing in pixel units between a legend and axis.
Used by coLegend to specify the default vertical spacing in pixel units between legend symbol entries.
Used by coLegend to specify the default direction of a color ramp legend.
Used by coLegend to specify the default maximum allowable length for labels in a color ramp legend.
Used by coLegend to specify the default vertical offset in pixel units for labels in a color ramp legend.
Used by coLegend to specify the default length in pixels of the primary axis of a color ramp legend.
Used by coLegend to specify the default opacity of a color ramp legend.
Used by coLegend to specify the default color for strokes in a color ramp legend.
Used by coLegend to specify the default width for strokes in a color ramp legend.
Used by coLegend to specify the default thickness in pixels of a color ramp legend.
Used by coLegend to specify the default alignment to apply to symbol legends rows and columns.
Used by coLegend to specify the default horizontal alignment of legend labels.
Used by coLegend to specify the default vertical alignment of legend labels.
Used by coLegend to specify the default color for legend labels.
Used by coLegend to specify the default font for legend labels.
Used by coLegend to specify the default font size of legend labels.
Used by coLegend to specify the default font style (italic etc.) of legend labels.
Used by coLegend to specify the default font weight of legend labels.
Used by coLegend to specify the default maximum width for legend labels in pixel units.
Used by coLegend to specify the default offset for legend labels.
Used by coLegend to specify the default for resolving overlapping legend labels.
Used by coLegend to specify the default legend symbol fill color for when no fill scale color in legend encoding.
Used by coLegend to specify the default legend symbol stroke color for when no stroke scale color in legend encoding.
Used by coLegend to specify the default legend symbol dash style in legend encoding.
Used by coLegend to specify the default legend symbol dash offset in legend encoding.
Used by coLegend to specify the default direction of a symbol legend.
Used by coLegend to specify the default legend symbol fill color.
Used by coLegend to specify the default legend symbol fill color.
Used by coLegend to specify the default horizontal pixel offset for legend symbols.
Used by coLegend to specify the default legend symbol opacity.
Used by coLegend to specify the default legend symbol size.
Used by coLegend to specify the default legend symbol outline color.
Used by coLegend to specify the default legend symbol stroke width.
Used by coLegend to specify the default legend symbol type.
Used by coLegend to specify the default to not displaying any legend titles.
Used by coLegend to specify the default horizontal alignment for legend titles.
Used by coLegend to specify the default anchoring for legend titles.
Used by coLegend to specify the default vertical alignment for legend titles.
Used by coLegend to specify the default color legend titles.
Used by coLegend to specify the default font for legend titles.
Used by coLegend to specify the default font size for legend titles.
Used by coLegend to specify the default font style (italic etc) for legend titles.
Used by coLegend to specify the default font weight for legend titles.
Used by coLegend to specify the default maximum size in pixel units for legend titles.
Used by coLegend to specify the default line height for multi-line legend titles.
Used by coLegend to specify the default opacity of a legend's title.
Used by coLegend to specify the default spacing in pixel units between title and legend.
Used by coLegend to specify the default opacity of unselected legend items when made interactive via paBindLegend.
Provide an expression to a scale property configuration function requiring a Boolean value. Used by coScale.
Provide an expression to a scale property configuration function requiring a numeric value. Used by coScale.
Default inner padding for x and y band-ordinal scales. Used by coScale.
Default inner padding for x and y band-ordinal scales of bar marks. Used by coScale.
Default inner padding for x and y band-ordinal scales of rect marks. Used by coScale.
Default outer padding for x and y band-ordinal scales. Used by coScale.
Default padding for continuous scales. Used by coScale.
Default padding for point-ordinal scales. Used by coScale.
Whether or not by default values that exceed the data domain are clamped to the min/max range value. Used by coScale.
Default maximum value for mapping quantitative fields to a bar's size/bandSize. Used by coScale.
Default minimum value for mapping quantitative fields to a bar's size/bandSize. Used by coScale.
Default maximum value for mapping a quantitative field to a text mark's size. Used by coScale.
Default minimum value for mapping a quantitative field to a text mark's size. Used by coScale.
Default maximum opacity (in the range [0, 1]) for mapping a field to opacity. Used by coScale.
Default minimum opacity (0 to 1) for mapping a field to opacity. Used by coScale.
Default maximum size for point-based scales. Used by coScale.
Default minimum size for point-based scales (when not forced to start at zero). Used by coScale.
Default maximum stroke width for rule, line and trail marks. Used by coScale.
Default minimum stroke width for rule, line and trail marks. Used by coScale.
Whether or not numeric values are rounded to integers when scaling. Useful for snapping to the pixel grid. Used by coScale.
Whether or not to use the source data range before aggregation. Used by coScale.
Whether or not to reverse the x-scaling by default (useful for right to left charts). Used by coScale.
Whether or not to default to include zero in any continuous scaling. Used by coScale.
Default color scheme for categorical ranges. Used by coRange.
Default diverging color scheme. Used by coRange.
Default 'heatmap' color scheme. Used by coRange.
Default ordinal color scheme. Used by coRange.
Default ramp (continuous) color scheme. Used by coRange.
Default set of symbols for shape encoding. Used by coRange.
Default set of symbols for shape encoding determined by the value of the given expression. Used by coRange.
Unlike title title configuration applies to all titles if multiple views are created. See the Vega-Lite title configuration documentation
Configure default title anchor position via coTitle.
Configure default title text orientation (degrees from horizontal) via coTitle.
Configure default vertical alignment of title text via coTitle.
Configure default delta offset of title and subtitle x-position via coTitle.
Configure default delta offset of title and subtitle y-position via coTitle.
Configure default title font size via coTitle.
Configure default title font style (italic etc.) via coTitle.
Configure default title font weight via coTitle.
Configure default title line height (vertical spacing) via coTitle.
Configure default color of a subtitle via coTitle.
Configure default font name of a subtitle via coTitle.
Configure default font size of a subtitle via coTitle.
Configure default font style of a subtitle such as "normal" or "italic"
via coTitle.
Configure default font weight of a subtitle via coTitle.
Configure default line height in pixels of each line of text in a subtitle via coTitle.
Configure default padding in pixels between title and subtitle text via coTitle.
Configure default title offset in pixel units relative to the chart body. Used by coTitle.
Configure default placement of titles relative to the chart body via coTitle.
A list of named styles to apply to titles. A named style can be specified via coMarkStyles if more than one style is required. Later styles in the list will override earlier styles if there is a conflict in any of the mark properties specified. Used by coTitle.
Configure default drawing order of titles relative to the other chart elements. 1 indicates titles are drawn in front of chart marks, 0 indicates they are drawn behind them. Used by coTitle.
Configure the default single view style via coView.
Configure default width of single views when the plot has continuous x-field via coView.
Configure default height of single views when the plot has continuous y-field via coView.
Configure the default cursor for single views via coView.
Configure default width of single views when the plot has discrete x-field via coView.
Configure default height of single views when the plot has discrete y-field via coView.
Configure whether or not by default single views should be clipped. Clipping will remove everything outside the data area including axes and legends. Used by coView.
Configure the default radius in pixels of rounded rectangle corners via coView.
Configure default fill color for single views via coView.
Configure default fill opacity for single views via coView.
Configure default overall opacity for single views via coView.
Configure default step size for x/y discrete fields via coView.
Configure the default stroke color for single views. If Nothing is provided,
no strokes are drawn around the view. Used by coView.
Configure the default stroke cap line-ending style for single views via coView.
Configure the default stroke dash style for single views via coView.
Configure the default stroke dash offset for single views via coView.
Configure the default stroke line-joining style for single views via coView.
Configure the default stroke mitre limit at which to bevel a line join in single views via coView.
Configure the default stroke opacity for single views via coView.
Confgure the default stroke width of single views via coView.
Anchor some text at its start. Used by axTitleAnchor, axcoTitleAnchor, leTitleAnchor, lecoTitleAnchor, hdLabelAnchor, hdTitleAnchor, tiAnchor and ticoAnchor.
Anchor some text in its start. Used by axTitleAnchor, axcoTitleAnchor, leTitleAnchor, lecoTitleAnchor, hdLabelAnchor, hdTitleAnchor, tiAnchor and ticoAnchor.
Specify an anchor style ("start", "middle", "end") with an expression. Used by axTitleAnchor, axcoTitleAnchor, leTitleAnchor, lecoTitleAnchor, hdLabelAnchor, hdTitleAnchor, tiAnchor and ticoAnchor.
Field titles to be displayed fully, such as 'Sum of field', 'Year of date' etc. Used by coFieldTitle.
Field titles to be displayed as 'SUM(field)', 'YEAR(date)' etc. Used by coFieldTitle.
Field titles to be displayed simply by their name without additional text. Used by coFieldTitle.
Configuration option for the maximum number of columns to use in a faceted flow layout. Used by coFacet.
Configuration option for the spacing in pixels between sub-views in a faceted view. Used by coFacet.
Configuration option for the maximum number of columns to use in a concatenated flow layout. Used by coConcat.
Configuration option for the spacing in pixels between sub-views in a concatenated view. Used by coConcat.
See the Vega locale documentation.
Symbol used to indicate decimal point as part of a locale specification.
Symbol used to indicate 'thousands' separator as part of a locale specification. Note that digits may be grouped in units other than thousands if loGrouping is set to a value other than 3.
Number of digits to represent what is by default a 'thousands' group, as part of a locale specification.
Indicate prefix (first parameter) and suffix (second parameter) currency symbols as part of a locale specification. For example
loCurrency "£" ""List of 10 symbols to replace the numerals 0–9 as part of a locale specification.
Symbol used to indicate percentages as part of a locale specification.
Symbol used to indicate minus/negative as part of a locale specification.
Symbol used to indicate a 'not-a-number' value, as part of a locale specification.
Default format of date-time representation as part of a locale specification.. Uses d3-time-format symbols. For example,
loDatetime "%a %b %e %X %Y"Default format of date representation as part of a locale specification. Uses d3-time-format symbols. For example,
loDate "%_d %B %Y"Default format of time representation as part of a locale specification. Uses d3-time-format symbols. For example,
loTime "%I:%M %p"Symbols used to indicate a time of day 'AM' (first parameter) and 'PM' (second parameter) equivalent, as part of a locale specification. For example,
loPeriods "a.m." "p.m."List of the text representing the 7 days of the week (starting Sunday) as part of a locale specification.
List of the text representing the 7 abbreviated days of the week (starting Sunday) as part of a locale specification.
List of the text representing the 12 months of the year (starting January) as part of a locale specification.
List of the text representing the 12 abbreviated months of the year (starting January) as part of a locale specification.
In addition to more general data types like integers and strings, the following types can carry data used in specifications and Vega-Lite parameters.
A Boolean data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
A true value used for functions that can accept a Boolean literal or a reference
to something that generates a Boolean value. Convenience function equivalent to boo True.
Used by dataRow, paValue, pDatum, mDatum, tDatum,
datumArray, inDatumOptions, imNewValue, fiEqual,
fiLessThan, fiLessThanEq, fiGreaterThan,
fiGreaterThanEq and fiOneOf.
A false value used for functions that can accept a Boolean literal or a
reference to something that generates a Boolean value. Convenience function
equivalent to boo False. Used by dataRow, paValue, pDatum,
mDatum, tDatum, datumArray, inDatumOptions,
imNewValue, fiEqual, fiLessThan, fiLessThanEq,
fiGreaterThan, fiGreaterThanEq and fiOneOf.
Date-time data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
A numeric data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
A string data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
A data value created by the given expression. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
A list of data values created by the given expression. Used by dataColumn, fiOneOf, imKeyVals, soCustom, axValues, leValues, paValues, inDataOptions, dataArrays and daConcat.
List of data values. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
Unlike nums, strs etc., this allows a single array to store mixed types and nested values. For example,
datumArray [ num 10, str "a", datumArray [ num 99, boo False ] ]Like datumArray except stores a collection of DataValues
(like strs, nums) instead of singular datum items. This is just
a convenience function for replicating a datumArray that contains lists of items
of the same type. For example,
dataArrays [ nums [ 10, 20, 30 ], strs [ "a", "b", "c" ] ]is equivalent to
datumArray
[ datumArray [ num 10, num 20, num 30 ]
, datumArray [ str "a", str "b", str "c" ]
]Key-value pairs representing a named data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
For example,
paValue (dataObject [ ( "x", num 3500 ), ( "firstName", str "Ada" ) ])Generate a collection of lists of Key-value pairs representing named data values. Used by dataColumn, fiOneOf, imKeyVals, soCustom, axValues, leValues, paValues, inDataOptions, dataArrays and daConcat.
An unspecified data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
Can be useful when explicitly recoding a value as undefined.
data =
dataFromRows []
<< dataRow [ ( "x", num 1 ), ( "y", num 10 ) ]
<< dataRow [ ( "x", num 2 ), ( "y", nullValue ) ]
<< dataRow [ ( "x", num 3 ), ( "y", num 30 ) ]For more complex data sources that contain lists of defined and unspecified values, consider using dataFromJson instead.
Concatenate a list of data values as a single data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.
For example,
param "location" [ paValue (daConcat (nums [ 4000, 8000 ])) ]A list of Boolean data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).
List of date-time data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).
List of numeric data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).
A list of string data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).
See the Vega-Lite dateTime documentation and the Vega-Lite time unit documentation.
Identify a month of the year.
Day of the week.
Hours and minutes time unit used for discretizing temporal data.
Hours, minutes and seconds time unit used for discretizing temporal data.
Milliseconds time unit used for discretizing temporal data.
Minutes and seconds time unit used for discretizing temporal data.
Month of the year used for discretizing temporal data. This will ignore year so useful for looking at monthly seasonal patterns through the year.
Day of the year for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns through the year.
Hour of the year used for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns with hourly resolution.
Minute of the year used for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns with one-minute resolution.
Second of the year used for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns with one-second resolution.
Year quarter and month time unit used for discretizing temporal data.
Seconds and milliseconds time unit used for discretizing temporal data.
Indicate temporal binning by week of year, so a 10 year sequence would have up to 53 bins. Weeks are Sunday-based and days before the first Sunday of the year are considered to be in week 0, the first Sunday of the year is the start of week 1, the second Sunday week 2, etc. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.
UTC version of a given a time (coordinated universal time, independent of local
time zones or daylight saving). To encode a time as UTC (coordinated universal time,
independent of local time zones or daylight saving), just use this function to convert
another TimeUnit generating function.
encoding
<< position X
[ pName "date"
, pTemporal
, pTimeUnit (utc yearMonthDateHours)
]Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval and tuStep.
Specify the maximum number of bins used when discretizing time units. Can be useful as an alternative to explicitly providing a time unit to bin by as it will be inferred from the temporal domain extent and the number of bins. For example, when applied to a dataset of hourly readings for a full year, the following will bin into days:
tuMaxBins 366Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.
Specify the the number of steps between time unit bins, in terms of the least significant unit provided. For example, the following will bin temporal data into biweekly weekly groups:
tuStep 14 yearMonthDateUsed by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, and utc.
Types that are not specified directly, provided here for reference with links to the functions that generate them.
Generated by arEnable, arDisable, arDescription and arExpr.
Generated by axAria, axBandPosition, axMaxExtent, axMinExtent, axOrient, axOffset, axPosition, axZIndex, axDataCondition, axDomain, axDomainCap, axDomainColor, axDomainDash, axDomainDashOffset, axDomainOpacity, axDomainWidth, axFormat, axTemporalFormats, axFormatAsNum, axFormatAsTemporal, axFormatAsCustom, axLabels, axLabelAlign, axLabelAngle, axLabelBaseline, axLabelBound, axLabelColor, axLabelExpr, axLabelFlush, axLabelFlushOffset, axLabelFont, axLabelFontSize, axLabelFontStyle, axLabelFontWeight, axLabelLimit, axLabelLineHeight, axLabelOffset, axLabelOpacity, axLabelOverlap, axLabelPadding, axLabelSeparation, axStyle, axTranslate, axTicks, axTickCap, axTickColor, axTickCount, axTickDash, axTickDashOffset, axTickExtra, axTickOffset, axTickOpacity, axTickRound, axTickSize, axTickMinStep, axTickWidth, axValues, axTitle, axTitleAlign, axTitleAnchor, axTitleAngle, axTitleBaseline, axTitleColor, axTitleFont, axTitleFontSize, axTitleFontStyle, axTitleFontWeight, axTitleLimit, axTitleLineHeight, axTitleOpacity, axTitlePadding, axTitleX, axTitleY, axGrid, axGridCap, axGridColor, axGridDash, axGridDashOffset, axGridOpacity and axGridWidth.
Generated by axcoAria, axcoBandPosition, axcoDisable, axcoDomain, axcoDomainCap, axcoDomainColor, axcoDomainDash, axcoDomainDashOffset, axcoDomainOpacity, axcoDomainWidth, axcoMaxExtent, axcoMinExtent, axcoGrid, axcoGridCap, axcoGridColor, axcoGridDash, axcoGridDashOffset, axcoGridOpacity, axcoGridWidth, axcoLabels, axcoLabelAlign, axcoLabelAngle, axcoLabelBaseline, axcoLabelBound, axcoLabelBoundExpr axcoLabelColor, axcoLabelExpr, axcoLabelFlush, axcoLabelFlushOffset, axcoLabelFont, axcoLabelFontSize, axcoLabelFontStyle, axcoLabelFontWeight, axcoLabelLimit, axcoLabelLineHeight, axcoLabelOffset, axcoLabelOpacity, axcoLabelOverlap, axcoLabelPadding, axcoLabelSeparation, axcoOffset, axcoTicks, axcoTickColor, axcoTickCount, axcoGridDash, axcoGridDashOffset, axcoTickCap, axcoTickExtra, axcoTickOffset, axcoTickOpacity, axcoTickRound, axcoTickSize, axcoTickMinStep, axcoTickWidth, axcoTitleAlign, axcoTitleAnchor, axcoTitleAngle, axcoTitleBaseline, axcoTitleColor, axcoTitleFont, axcoTitleFontSize, axcoTitleFontStyle, axcoTitleFontWeight, axcoTitleLimit, axcoTitleLineHeight, axcoTitleOpacity, axcoTitlePadding, axcoTitleX, axcoTitleY and axcoTranslate.
Generated by bmNormal, bmMultiply, bmScreen, bmOverlay, bmDarken, bmLighten, bmColorDodge, bmColorBurn, bmHardLight, bmSoftLight, bmDifference, bmExclusion, bmHue, bmSaturation, bmColor, bmLuminosity and bmExpr.
Generated by noClip, clipRect and clipRectExpr.
Generated by cocoColumns and cocoSpacing.
Generated by cAxLabelAlign, cAxLabelBaseline, cAxLabelColor, cAxLabelFont, cAxLabelFontSize, cAxLabelFontStyle, cAxLabelFontWeight, cAxLabelOffset, cAxLabelOpacity, cAxLabelPadding, cAxTickColor, cAxTickDash, cAxTickDashOffset, cAxTickOpacity, cAxTickSize, cAxTickWidth, cAxGridColor, cAxGridDash, cAxTickDashOffset, cAxGridOpacity and cAxGridWidth.
Generated by coArea,coAria, coAutosize, coAxis, coAxisStyles, coAxisXFilter, coAxisYFilter, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisTemporal, coAxisQuant, coBackground, coBar, coCircle, coConcat, coCountTitle, coCustomFormatTypes, coFieldTitle,coGeoshape, coFacet, coHeader, coLegend, coLocale, coLine, coMark, coMarkStyles, coNormalizedNumberFormat, coNumberFormat, coNumberFormatType, coNormalizedNumberFormatType, coTooltipFormat, coPadding, coPoint, coProjection, coRange, coRect, coRule, coScale, coSelection, coSquare, coText, coFont, coTick, coTitle, coTimeFormat, coTimeFormatType, coTrail and coView.
Generated by cuAuto, cuDefault, cuNone, cuContextMenu, cuHelp, cuPointer, cuProgress, cuWait, cuCell, cuCrosshair, cuText, cuVerticalText, cuAlias, cuCopy, cuMove, cuNoDrop, cuNotAllowed, cuAllScroll, cuColResize, cuRowResize, cuNResize, cuEResize, cuSResize, cuWResize, cuNEResize, cuNWResize, cuSEResize, cuSWResize, cuEWResize, cuNSResize, cuNESWResize, cuNWSEResize, cuZoomIn, cuZoomOut, cuGrab, cuGrabbing and cuExpr.
Generated by boos, dts, nums, strs, dataExpr, dataArrays and dataObjects.
Generated by dtYear, dtQuarter, dtMonth, dtDate, dtDay, dtHour, dtMinute, dtSecond, dtMillisecond and fromPosixTime.
Generated by dnGroupBy, dnCumulative, dnCounts, dnBandwidth, dnExtent, dnMinSteps, dnMaxSteps, dnSteps and dnAs.
Generated by facoColumns and facoSpacing.
Generated by ftVerbal, ftFunction and ftPlain.
Generated by fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq, fiExpr, fiCompose, fiSelection, fiSelectionEmpty, fiOneOf, fiRange and fiValid.
Generated by csv, dsv, tsv, arrow, parse, jsonProperty, topojsonFeature and topojsonMesh.
Generated by geoPoint, geoPoints, geoLine, geoLines, geoPolygon and geoPolygons.
Generated by grExtent, grExtentMajor, grExtentMinor, grStep, grExtentMajor, grExtentMinor and grPrecision.
Generated by hdFormat, hdFormatAsNum, hdFormatAsTemporal, hdFormatAsCustom, hdLabelAlign, hdLabelAnchor, hdLabelAngle, hdLabelBaseline, hdLabelColor, hdLabelExpr, hdLabelFont, hdLabelFontSize, hdLabelFontStyle, hdLabelFontWeight, hdLabelLimit, hdLabelLineHeight, hdLabelOrient, hdLabelPadding, hdLabels, hdOrient, hdTitle, hdTitleAlign, hdTitleAnchor, hdTitleAngle, hdTitleBaseline, hdTitleColor, hdTitleFont, hdTitleFontWeight, hdTitleFontSize, hdTitleFontStyle, hdTitleLimit, hdTitleOrient and hdTitlePadding.
Generated by imKeyVals, imKeyValSequence imFrame, imGroupBy, imMethod and imNewValue.
Generated by inDebounce, inElement, inOptions, inDatumOptions, inDataOptions, inMin, inMax, inName, inStep and inPlaceholder.
Generated by leGradient and leSymbol.
Generated by lecoAria, lecoClipHeight, lecoColumnPadding, lecoColumns, lecoCornerRadius, lecoDirection, lecoDisable, lecoFillColor, lecoOrient, lecoOffset, lecoStrokeColor, lecoStrokeDash, lecoStrokeWidth, lecoPadding, lecoRowPadding, lecoGradientDirection, lecoGradientLabelLimit,lecoGradientLabelOffset, lecoGradientOpacity, lecoGradientStrokeColor, lecoGradientStrokeWidth, lecoGradientLength, lecoGradientThickness, lecoGridAlign, lecoLabelAlign, lecoLabelBaseline, lecoLabelColor, lecoLabelFont, lecoLabelFontSize, lecoLabelFontStyle, lecoLabelFontWeight, lecoLabelLimit, lecoLabelOffset, lecoLabelOverlap, lecoSymbolBaseFillColor, lecoSymbolBaseStrokeColor, lecoSymbolDash, lecoSymbolDashOffset, lecoSymbolDirection, lecoSymbolFillColor, lecoSymbolLimit, lecoSymbolOffset, lecoSymbolOpacity, lecoSymbolSize, lecoSymbolStrokeColor, lecoSymbolStrokeWidth, lecoSymbolType, lecoNoTitle, lecoTitleAlign, lecoTitleAnchor, lecoTitleBaseline, lecoTitleColor, lecoTitleFont, lecoTitleFontSize, lecoTitleFontStyle, lecoTitleFontWeight, lecoTitleLimit, lecoTitleLineHeight, lecoTitlePadding, lecoUnselectedOpacity, lecoX and lecoY.
Generated by loLeft, loTopLeft, loTop, loTopRight, loRight, loBottomRight, loBottom, loBottomLeft and loNone.
Generated by leAria, leGradient, leSymbol, leClipHeight, leColumnPadding, leColumns, leCornerRadius, leDirection, leFillColor, leFormat, leFormatAsNum, leFormatAsTemporal, leFormatAsCustom leGradientLength, leGradientOpacity leGradientThickness, leGradientStrokeColor, leGradientStrokeWidth, leGridAlign, leLabelAlign, leLabelBaseline, leLabelColor, leLabelFont, leLabelFontSize, leLabelLimit, leLabelOffset, leLabelOverlap, leOffset, leOrient, lePadding, leRowPadding, leStrokeColor, leStrokeWidth, leSymbolDash, leSymbolDashOffset leSymbolFillColor, leSymbolLimit, leSymbolOffset, leSymbolOpacity, leSymbolSize, leSymbolStrokeColor, leSymbolStrokeWidth, leSymbolType, leTickCount, leTitle, leTitleAlign, leTitleAnchor, leTitleBaseline, leTitleColor, leTitleFont, leTitleFontStyle, leTitleFontSize, leTitleFontWeight, leTitleLimit, leTitleLineHeight, leTitleOrient, leTitlePadding, leType, leValues, leX, leY and leZIndex.
Generated by lsGroupBy, lsBandwidth and lsAs.
Generated by luFields, luFieldsAs, luAs, luFieldsWithDefault, luFieldsAsWithDefault and luAsWithDefault
Generated by miBasis, miBasisClosed, miBasisOpen, miBundle, miCardinal, miCardinalClosed, miCardinalOpen, miLinear, miLinearClosed, miMonotone, miStepwise, miStepAfter, miStepBefore and miExpr.
Generated by moHorizontal and moVertical.
Generated by maAlign, maAngle, maAria, maBandSize, maBaseline, maBinSpacing, maBlend, maBorders, maBox, maClip, maColor, maColorGradient, maCornerRadius, maCornerRadiusEnd, maCornerRadiusTopLeft, maCornerRadiusTopRight, maCornerRadiusBottomLeft, maCornerRadiusBottomRight, maCursor, maHRef, maContinuousBandSize, maDir, maDiscreteBandSize, maDx, maDy, maEllipsis, maExtent, maFill, maFillGradient, maFilled, maFillOpacity, maFont, maFontSize, maFontStyle, maFontWeight, maInnerRadius, maOuterRadius, maInterpolate, maLimit, maLine, maLineHeight, maMedian, maOpacity, maOutliers, maOrient, maPadAngle, maPoint, maRadius, maRadiusOffset, maRadius2Offset, maRemoveInvalid, maRule, maShape, maShortTimeLabels, maSize, maStroke, maStrokeGradient, maStrokeCap, maStrokeDash, maStrokeDashOffset, maStrokeJoin, maStrokeMiterLimit, maStrokeOpacity, maStrokeWidth, maStyle, maTension, maText, maTheta, maTheta2, maThetaOffset, maTheta2Offset,maThickness, maTicks, maTooltip, maUrl, maX, maWidth, maWidthBand, maHeight, maHeightBand, maY, maXOffset, maYOffset, maX2, maY2,maX2Offset and maY2Offset.
Generated by oName, oRepeat, oQuant, oNominal, oOrdinal, oTemporal, oGeo, oBin, oAggregate, oTimeUnit, oSort, oNum, oCondition and oConditions.
Generated by paSize, paEdges and paEdgesExpr.
Generated by paBind, paBindings, paBindLegend, paBindScales, paExpr, paValue, paValues and paSelect.
Generated by pmNone, pmTransparent and pmMarker.
Generated by prParam, prParamEmpty and prTest.
Generated by prType, prClipAngle, prClipExtent, prCenter, prFit, prScale, prTranslate, prRotate, prRotateExpr, prPrecision, prCoefficient, prDistance, prFraction, prLobes, prParallels, prParallelsExpr, prReflectX, prReflectY, prParallel, prPointRadius, prRadius, prRatio, prSpacing and prTilt.
Generated by racoCategory, racoDiverging, racoHeatmap, racoOrdinal, racoRamp, racoSymbols and <racoSymbolsExpr>.
Generated by rowFields, columnFields and layerFields.
Generated by reShared and reIndependent.
Generated by scLinear, scPow, scSqrt, scLog, scSymLog, scTime, scUtc, scOrdinal, scBand, scPoint, scBinOrdinal, scQuantile, scQuantize and scThreshold.
Generated by doNums, doMin, doMid, doMax, doStrs, doDts, doDtsExpr, doMinDt, doMinDtExpr, doMaxDt, doMaxDtExpr, doSelection, doSelectionChannel, doSelectionField, doUnionWith and doUnaggregated.
Generated by niTrue, niFalse, niMillisecond, niSecond, niMinute, niHour, niDay, niWeek, niMonth, niYear, niTickCount, niInterval and niExpr.
Generated by scType, scDomain, scDomainExpr, scRange, scScheme, scSchemeExpr, scAlign, scPadding, scPaddingInner, scPaddingOuter, scReverse, scRound, scClamp, scInterpolate, scNice, scExponent, scConstant, scBase and scZero.
Generated by sacoBandPaddingInner, sacoBandPaddingOuter, sacoBarBandPaddingInner, sacoRectBandPaddingInner, sacoClamp, sacoContinuousPadding, sacoMaxBandSize, sacoMinBandSize, sacoMaxFontSize, sacoMinFontSize, sacoMaxOpacity, sacoMinOpacity, sacoMaxSize, sacoMinSize, sacoMaxStrokeWidth, sacoMinStrokeWidth, sacoPointPadding, sacoRound, sacoUseUnaggregatedDomain, sacoXReverse and sacoZero.
Generated by sePoint and seInterval.
Generated by smFill, smFillOpacity, smStroke, smStrokeDash, smStrokeDashOffset, smStrokeOpacity, smStrokeWidth and smCursor.
Generated by seClear, seEncodings,seFields, seNearest, seOn, seResolve, seSelectionMark, seToggle, seTranslate and seZoom.
Generated by seGlobal, seUnion and seIntersection.
Generated by stAscending, wiAscending, stDescending and wiDescending.
Generated by soAscending, soDescending, soByField, soByChannel, soByRepeat and soCustom.
Generated by stZero, stCenter, stNormalize and stNone.
Generated by symCircle, symSquare, symCross, symDiamond, symTriangleUp, symTriangleDown, symTriangleLeft, symTriangleRight, symPath, symStroke, symArrow, symWedge,symTriangle and symExpr.
Generated by tName, tRepeat, tQuant, tNominal, tOrdinal, tTemporal, tGeo, tBin, tBinned, tAggregate, tTimeUnit, tTitle, tCondition, tConditions, tFormat, tFormatAsNum, tFormatAsTemporal, tFormatAsCustom, tStr and tDatum.
Generated by date, day, dayOfYear, dayHours, dayHoursMinutes, dayHoursMinutesSeconds, hours, hoursMinutes, hoursMinutesSeconds, milliseconds, minutes, minutesSeconds, month, monthDate, monthDateHoursMinutes, monthDateHoursMinutesSeconds, quarter, quarterMonth, seconds, secondsMilliseconds, week, weekDay, weekDayHours, weekDayHoursMinutes, weekDayHoursMinutesSeconds, year, yearQuarter, yearQuarterMonth, yearMonth, yearMonthDate, yearMonthDateHours, yearMonthDateHoursMinutes, yearMonthDateHoursMinutesSeconds, yearWeek, yearWeekDay, yearWeekDayHours, yearWeekDayHoursMinutes, yearWeekDayHoursMinutesSeconds, yearDayOfYear, utc, tuMaxBins and tuStep.
Generated by ticoAnchor, ticoAngle, ticoBaseline, ticoColor, ticoDx, ticoDy, ticoFont, ticoFontSize, ticoFontStyle, ticoFontWeight, ticoFrame, ticoLimit, ticoLineHeight, ticoOffset, ticoOrient, ticoStyle, ticoSubtitleColor, ticoSubtitleFont, ticoSubtitleFontSize, ticoSubtitleFontStyle, ticoSubtitleFontWeight, ticoSubtitleLineHeight, ticoSubtitlePadding and ticoZIndex.
Generated by tiAnchor, tiAngle, tiBaseline, tiColor, tiDx, tiDy, tiFont, tiFontSize, tiFontStyle, tiFontWeight, tiFrame, tiLimit, tiLineHeight,tiOffset, tiOrient, tiStyle tiSubtitle, tiSubtitleColor, tiSubtitleFont, tiSubtitleFontSize, tiSubtitleFontStyle, tiSubtitleFontWeight, tiSubtitleLineHeight, tiSubtitlePadding and tiZIndex.
Generate by tpFalse, tpShiftKey, tpCtrlKey, tpAltKey and tpExpr.
Generated by ttEncoding, ttData and ttNone.
Generated by vaTop, vaLineTop, vaMiddle, vaAlphabetic, vaBottom, vaLineBottom and vaExpr.
Generated by vicoBackground, vicoClip, vicoContinuousHeight, vicoContinuousWidth, vicoCursor, vicoDiscreteHeight, vicoDiscreteWidth, vicoCornerRadius, vicoFill, vicoFillOpacity, vicoOpacity, vicoStep, vicoStroke, vicoStrokeCap, vicoStrokeDash, vicoStrokeDashOffset, vicoStrokeJoin, vicoStrokeMiterLimit, vicoStrokeOpacity and vicoStrokeWidth.
Generated by wiAggregateOp, wiOp, wiParam and wiField.
Generated by woRowNumber, woRank, woDenseRank, woPercentRank, woCumeDist, woPercentile, woLag, woLead, woFirstValue, woLastValue, and woNthValue.
Generated by wiFrame, wiIgnorePeers, wiGroupBy and wiSort.
Deprecated. Axis choices are now specified with coAxisXFilter and coAxisYFilter.
Deprecated. Use coAxisXFilter instead.
Deprecated. UsecoAxisYFilter instead.
Deprecated: Instead use dtMonth instead. This will likely be removed in the next major release as it was redundant.
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 data, mark and encoding specifications.
While simple functions like
barmay be provided directly, it is usually clearer to label more complex functions such as encodings with separate expressions.Specifications can be built up by chaining functions such as dataColumn or position. Functional composition using the
<<operator allows this to be done compactly: