gicentre / elm-vegalite / VegaLite

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.

  1. Creating a Specification
  2. Specifying the Data to Visualize
  3. Transforming Data
  4. Specifying Marks
  5. Encoding Data as Channels
  6. View Composition
  7. Parameters
  8. Top-level Settings
  9. General Data Functions
  10. Type Reference

1. Creating A Vega-Lite Specification

toVegaLite : List ( VLProperty, Spec ) -> Spec

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 bar may 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:

myChart : Spec
myChart =
    let
        data =
            dataFromColumns []
                << dataColumn "a" (strs [ "C", "C", "D" ])
                << dataColumn "b" (nums [ 2, 7, 1 ])

        enc =
            encoding
                << position X [ pName "a" ]
                << position Y [ pName "b", pAggregate opMean ]
    in
    toVegaLite [ data [], enc [], bar [] ]


type VLProperty

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.


type alias Spec =
Json.Encode.Value

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 =
    ...


type alias LabelledSpec =
( String, Spec )

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.

combineSpecs : List LabelledSpec -> Spec

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 )
        ]

2. Specifying the Data to Visualize

To create a visualization, you will need to specify what data you wish to visualize. For context, see the Vega-Lite documentation.

dataFromUrl : String -> List Format -> Data

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 )
            ]
        ]

dataFromColumns : List Format -> List DataColumn -> Data

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.

dataColumn : String -> DataValues -> List DataColumn -> List DataColumn

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 [], ... ]

dataFromRows : List Format -> List DataRow -> 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.

dataRow : List ( String, DataValue ) -> List DataRow -> List DataRow

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 [], ...]

dataFromJson : Spec -> List Format -> 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 [], ... ]

jsonToSpec : String -> Spec

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/vega-datasets@2.2/data/cars.json"},
    "mark": "bar",
    "encoding": {
        "x": { "field": "Origin" },
        "y": { "field": "Miles_per_Gallon", "aggregate": "mean" }
    }
}
""" |> jsonToSpec

But note this is not type-safe – if the JSON is not well-formed, a JSON null value is returned.

datasets : List ( String, Data ) -> Data

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" []
        , ...
        ]

dataFromSource : String -> List Format -> Data

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" []
        , ...
        ]

dataName : String -> Data -> Data

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 , ...]

noData : Data

Ignore the data of a specification's parent when used in a composed spec such as layering or concatenation.


type alias Data =
( VLProperty, Spec )

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 alias DataColumn =
List LabelledSpec

Type annotation for a single column of data. Used when describing inline data with dataColumn.


type alias DataRow =
Spec

Type annotation for a single row of data. Used when describing inline data with dataRow.

2.1 Geographic Data

geometry : Geometry -> List ( String, DataValue ) -> Spec

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
    )
        []

geoFeatureCollection : List Spec -> Spec

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
    )
        []

geometryCollection : List Spec -> Spec

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
    )
        []

geoPoint : Basics.Float -> Basics.Float -> Geometry

Point geometry for programmatically creating GeoShapes. Equivalent to the GeoJson geometry point type.

myGeo : Data
myGeo =
    (geometry (geoPoint -3.5 55.5) []
        |> dataFromJson
    )
        []

geoPoints : List ( Basics.Float, Basics.Float ) -> Geometry

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
    )
        []

geoLine : List ( Basics.Float, Basics.Float ) -> Geometry

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
    )
        []

geoLines : List (List ( Basics.Float, Basics.Float )) -> Geometry

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
    )
        []

geoPolygon : List (List ( Basics.Float, Basics.Float )) -> Geometry

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
    )
        []

geoPolygons : List (List (List ( Basics.Float, Basics.Float ))) -> Geometry

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
    )
        []

2.2 Data Generators

Functions that create new data sources.

dataSequence : Basics.Float -> Basics.Float -> Basics.Float -> Data

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

dataSequenceAs : Basics.Float -> Basics.Float -> Basics.Float -> String -> Data

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"

sphere : Data

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" ]
        ]

graticule : List GraticuleProperty -> Data

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 ] ]

grStep : ( Basics.Float, Basics.Float ) -> GraticuleProperty

Set the step sizes between all graticule lines. The parameter is a (longitude,latitude) pair defining the EW and NS graticule intervals respectively.

grStepMajor : ( Basics.Float, Basics.Float ) -> GraticuleProperty

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.

grStepMinor : ( Basics.Float, Basics.Float ) -> GraticuleProperty

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.

grExtent : ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> GraticuleProperty

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.

grExtentMajor : ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> GraticuleProperty

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.

grExtentMinor : ( Basics.Float, Basics.Float ) -> ( Basics.Float, Basics.Float ) -> GraticuleProperty

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.

grPrecision : Basics.Float -> GraticuleProperty

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.

2.3 Formatting Input Data

See the Vega-Lite format and JSON documentation.

parse : List ( String, DataType ) -> Format

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 )
            ]
        ]

foNum : DataType

Indicate numeric data type to be parsed when reading input data. Used by parse.

foBoo : DataType

Indicate Boolean data type to be parsed when reading input data. Used by parse.

foDate : String -> DataType

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

foUtc : String -> DataType

Similar to foDate but for UTC format dates. Used by parse.

csv : Format

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 ]

tsv : Format

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 ]

dsv : Char -> Format

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 '|' ]

arrow : Format

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 ]

topojsonFeature : String -> Format

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" ]

topojsonMesh : String -> Format

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 ]
        ]

jsonProperty : String -> Format

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.

3. Transforming Data

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.

transform : List LabelledSpec -> ( VLProperty, Spec )

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"

3.1 Map Projections

See the Vega-Lite map projection documentation.

projection : List ProjectionProperty -> ( VLProperty, Spec )

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 [] ]

prNumExpr : String -> (number -> ProjectionProperty) -> ProjectionProperty

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 [] ]

prType : Projection -> ProjectionProperty

Type of global map projection. Used by projection and coProjection. For example,

myProj =
    projection [ prType orthographic ]

albers : Projection

An Albers equal-area conic map projection. Used by prType.

albersUsa : Projection

An Albers USA map projection that combines continental USA with Alaska and Hawaii. Unlike other projection types, this remains unaffected by prRotate. Used by prType.

azimuthalEqualArea : Projection

An azimuthal equal area map projection. Used by prType.

azimuthalEquidistant : Projection

An azimuthal equidistant map projection. Used by prType.

conicConformal : Projection

A conformal (shape-preserving) conic map projection. Used by prType.

conicEqualArea : Projection

An equal area conic map projection. Used by prType.

conicEquidistant : Projection

An equidistant conic map projection. Distance is preserved along a standard parallel (or two parallels for secant projections). Used by prType.

equalEarth : Projection

An Equal Earth map projection that provides a reasonable shape approximation while retaining relative areas. Used by prType.

equirectangular : Projection

An equirectangular map projection that maps longitude to x and latitude to y. While showing less area distortion towards the poles than the mercator projection, it is neither equal-area nor conformal. Used by prType.

gnomonic : Projection

A gnomonic map projection. Used by prType.

identityProjection : Projection

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.

mercator : Projection

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.

naturalEarth1 : Projection

A natural earth map projection. Used by prType.

orthographic : Projection

An orthographic map projection. Used by prType.

stereographic : Projection

A stereographic map projection. Used by prType.

transverseMercator : Projection

A transverse Mercator map projection. Used by prType.

customProjection : String -> Projection

Custom projection type. Additional custom projections from d3 can be defined via the Vega API and called from with this function where the parameter is the name of the D3 projection to use (e.g. customProjection "winkel3"). Used by prType.

prExpr : String -> Projection

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 [] ]

prClipAngle : Basics.Float -> ProjectionProperty

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.

prClipExtent : ClipRect -> ProjectionProperty

Projection’s viewport clip extent to the specified bounds in pixels. Used by projection and coProjection.

noClip : ClipRect

Indicate no clipping to be applied. Used by prClipExtent.

clipRect : Basics.Float -> Basics.Float -> Basics.Float -> Basics.Float -> ClipRect

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 []
        ]

clipRectExpr : String -> String -> String -> String -> ClipRect

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 []
        ]

prFit : Spec -> ProjectionProperty

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 ]

prCenter : Basics.Float -> Basics.Float -> ProjectionProperty

Projection’s center as longitude and latitude in degrees. Used by projection and coProjection.

prCenterExpr : String -> String -> ProjectionProperty

Specify a projection’s centre with two expressions that should evaluate to a longitude and latitude respectively. Used by projection and coProjection.

prScale : Basics.Float -> ProjectionProperty

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.

prTranslate : Basics.Float -> Basics.Float -> ProjectionProperty

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.

prTranslateExpr : String -> String -> ProjectionProperty

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.

prRotate : Basics.Float -> Basics.Float -> Basics.Float -> ProjectionProperty

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.

prRotateExpr : String -> String -> String -> ProjectionProperty

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.

prPrecision : Basics.Float -> ProjectionProperty

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.

prCoefficient : Basics.Float -> ProjectionProperty

'Hammer' map projection coefficient. Used by projection and coProjection.

prDistance : Basics.Float -> ProjectionProperty

'Satellite' map projection distance. Used by projection and coProjection.

prFraction : Basics.Float -> ProjectionProperty

Bottomley map projection fraction. Used by projection and coProjection.

prLobes : Basics.Int -> ProjectionProperty

Number of lobes in lobed map projections such as the 'Berghaus star'. Used by projection and coProjection.

prParallel : Basics.Float -> ProjectionProperty

Standard parallel for map projections such as the 'Armadillo'. Used by projection and coProjection.

prParallels : Basics.Float -> Basics.Float -> ProjectionProperty

A conic projection’s two standard parallels. Used by projection and coProjection.

prParallelsExpr : String -> String -> ProjectionProperty

Specify a conic projection’s two standard parallels with two expressions. Used by projection and coProjection.

prPointRadius : Basics.Float -> ProjectionProperty

Radius in pixels when drawing geo point features in a GeoFeature. Used by projection and coProjection.

prRadius : Basics.Float -> ProjectionProperty

Radius value for map projections such as the 'Gingery'. Used by projection and coProjection.

prRatio : Basics.Float -> ProjectionProperty

Ratio value for map projections such as the 'Hill'. Used by projection and coProjection.

prReflectX : Basics.Bool -> ProjectionProperty

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.

prReflectY : Basics.Bool -> ProjectionProperty

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.

prSpacing : Basics.Float -> ProjectionProperty

Spacing value for map projections such as the 'Lagrange'. Used by projection and coProjection.

prTilt : Basics.Float -> ProjectionProperty

'Satellite' map projection tilt. Used by projection and coProjection.

3.2 Aggregation

See the Vega-Lite aggregate documentation.

aggregate : List Spec -> List String -> List LabelledSpec -> List LabelledSpec

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" ]

joinAggregate : List Spec -> List WindowProperty -> List LabelledSpec -> List LabelledSpec

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

opAs : Operation -> String -> String -> Spec

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.

timeUnitAs : TimeUnit -> String -> String -> List LabelledSpec -> List LabelledSpec

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.

opArgMax : Maybe String -> Operation

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" ]

opArgMin : Maybe String -> Operation

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.

opCI0 : Operation

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.

opCI1 : Operation

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.

opCount : Operation

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.

opDistinct : Operation

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.

opMax : Operation

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.

opMean : Operation

Mean value to be used in an aggregation operation. Used by mAggregate, pAggregate, hAggregate, oAggregate, tAggregate, dAggregate, fAggregate, opAs, piOp, wiAggregateOp, soByField and soByRepeat.

opMedian : Operation

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.

opMin : Operation

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.

opMissing : Operation

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.

opProduct : Operation

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.

opQ1 : Operation

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.

opQ3 : Operation

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.

opStderr : Operation

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.

opStdev : Operation

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.

opStdevP : Operation

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.

opSum : Operation

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.

opValid : Operation

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.

opVariance : Operation

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.

opVarianceP : Operation

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.

3.3 Binning

See the Vega-Lite binning documentation.

binAs : List BinProperty -> String -> String -> List LabelledSpec -> List LabelledSpec

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.

biAnchor : Basics.Float -> BinProperty

Value in the binned domain at which to anchor the binning. Boundaries are possibly shifted to ensure they align with the anchor value. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biBase : Basics.Float -> BinProperty

Number base to use for automatic bin determination (default is base 10). Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biDivide : List Basics.Float -> BinProperty

Scale factors indicating allowable subdivisions for binning. The default value is [5, 2], which indicates that for base 10 numbers (the default base), binning will consider dividing bin sizes by 5 and/or 2. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biExtent : Basics.Float -> Basics.Float -> BinProperty

Desired extent of bin values when binning a collection of values. The first and second parameters indicate the minimum and maximum extent. To base a binning extent on an interactive selection, use biSelectionExtent instead. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biSelectionExtent : String -> BinProperty

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" ]
            ]

biMaxBins : Basics.Int -> BinProperty

Maximum number of bins when binning a collection of values. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biMinStep : Basics.Float -> BinProperty

Step size between bins when binning a collection of values. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biNice : Basics.Bool -> BinProperty

Whether or not binning boundaries use human-friendly values such as multiples of ten. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biStep : Basics.Float -> BinProperty

Step size between bins when binning a collection of values. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

biSteps : List Basics.Float -> BinProperty

Allowable step sizes between bins when binning a collection of values. Used by pBin, mBin, tBin, hBin, oBin, dBin and fBin.

3.4 Stacking

See the Vega-Lite stack documentation

stack : String -> List String -> String -> String -> List StackProperty -> List LabelledSpec -> List LabelledSpec

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.

stOffset : StackOffset -> StackProperty

Stack offset when applying a stack transformation.

stNormalize : StackOffset

Rescale a stacked layout to use a common height while preserving relative size of stacked quantities. Used by pStack and stOffset.

stCenter : StackOffset

Offset a stacked layout using a central stack baseline. Used by pStack and stOffset.

stZero : StackOffset

Offset a stacked layout using a baseline at the foot of a stack. Used by pStack and stOffset.

stNone : StackOffset

Do not stack marks (produces a layered plot). Used by pStack and stOffset.

stSort : List SortField -> StackProperty

Ordering within a stack when applying a stack transformation.

stAscending : String -> SortField

Indicate that the given field should be sorted in ascending order. Used by stSort.

stDescending : String -> SortField

Indicate that the given field should be sorted in descending order. Used by stSort.

3.5 Data Calculation

See Vega-Lite calculate documentation.

calculateAs : String -> String -> List LabelledSpec -> List LabelledSpec

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"

3.6 Filtering

See the Vega-Lite filter documentation.

filter : Filter -> List LabelledSpec -> List LabelledSpec

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

fiEqual : String -> DataValue -> Filter

Filter a data stream so that only data in a given field equal to the given value are used. Used by filter, fiOp and fiOpTrans.

fiLessThan : String -> DataValue -> Filter

Filter a data stream so that only data in a given field less than the given value are used. Used by filter, fiOp and fiOpTrans.

fiLessThanEq : String -> DataValue -> Filter

Filter a data stream so that only data in a given field less than or equal to the given value are used. Used by filter, fiOp and fiOpTrans.

fiGreaterThan : String -> DataValue -> Filter

Filter a data stream so that only data in a given field greater than the given value are used. Used by filter, fiOp and fiOpTrans.

fiGreaterThanEq : String -> DataValue -> Filter

Filter a data stream so that only data in a given field greater than or equal to the given value are used. Used by filter, fiOp and fiOpTrans.

fiExpr : String -> Filter

Filter a data stream so that only data that satisfy the given predicate expression are used. Used by filter, fiOp and fiOpTrans.

fiSelection : String -> Filter

Filter a data stream in response to the value of a selection parameter. Useful for creating interactive filtering from a selection. Used by filter, fiOp and fiOpTrans.

fiSelectionEmpty : String -> Filter

Similar to fiSelection except that an empty selection filters out all values. Used by filter, fiOp and fiOpTrans.

fiOp : Filter -> BooleanOp

Convert a filter into a BooleanOp so that it may be used as part of a more complex Boolean composition. Used by prTest, fiCompose, axDataCondition, and, or and not.

trans =
    transform
        << filter
            (fiCompose
                (and
                    (fiValid "IMDB_Rating" |> fiOp)
                    (fiValid "Rotten_Tomatoes_Rating" |> fiOp)
                )
            )

fiOpTrans : MarkChannel -> Filter -> BooleanOp

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.

fiCompose : BooleanOp -> Filter

Build up a filtering predicate through logical composition (and, or etc.). Used by filter, fiOp and fiOpTrans. For example, to filter only items selected interactively and that represent ages over 65:

trans =
    transform
        << filter
            (fiCompose
                (and (selected "brush") (expr "datum.age > 65"))
            )

fiOneOf : String -> DataValues -> Filter

Filter a data stream so that only data in a given field contained in the given list of values are used. Used by filter, fiOp and fiOpTrans.

fiRange : String -> FilterRange -> Filter

Filter a data stream so that only data in a given field that are within the given range are used. Used by filter, fiOp and fiOpTrans.

For example,

filter (fiRange "date" (dtRange [ dtYear 2006 ] [ dtYear 2016 ]))

fiValid : String -> Filter

Filter a data stream so that only valid data (i.e. not null or NaN) in a given field are used. Used by filter, fiOp and fiOpTrans.

numRange : Basics.Float -> Basics.Float -> FilterRange

Minimum-maximum number range to be used in data filtering. Used by fiRange.

dtRange : List DateTime -> List DateTime -> FilterRange

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.

3.7 Flattening

See the Vega-Lite flatten and fold documentation.

flatten : List String -> List LabelledSpec -> List LabelledSpec

Map array-valued fields to a set of individual data objects, one per array entry.

flattenAs : List String -> List String -> List LabelledSpec -> List LabelledSpec

Similar to flatten but allows the new output fields to be named (second parameter).

3.8 Folding and Pivoting

Data tidying operations that reshape the rows and columns of a dataset. See the Vega-Lite fold and pivot documentation.

fold : List String -> List LabelledSpec -> List LabelledSpec

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 ]

foldAs : List String -> String -> String -> List LabelledSpec -> List LabelledSpec

Similar to fold but allows the new output key and value fields to be given alternative names.

pivot : String -> String -> List PivotProperty -> List LabelledSpec -> List LabelledSpec

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 ]

piGroupBy : List String -> PivotProperty

The data fields to group by when performing a pivot. If not specified, a single group containing all data objects will be used.

piLimit : Basics.Int -> PivotProperty

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.

piOp : Operation -> PivotProperty

The aggregation to apply to grouped fields during a pivot.

3.9 Relational Joining

Create lookups between data tables in order to join values from multiple sources. See the Vega-Lite lookup documentation.

lookup : String -> Data -> String -> LookupFields -> List LabelledSpec -> List LabelledSpec

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

lookupSelection : String -> String -> String -> List LabelledSpec -> List LabelledSpec

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"

luFields : List String -> LookupFields

Names of the fields to be returned from a secondary data source when performing a lookup transformation.

luFieldsWithDefault : List String -> String -> LookupFields

The same as luFields except with a second parameter providing the default value if the lookup fails.

luFieldsAs : List ( String, String ) -> LookupFields

Names of the fields and their aliases to be returned from a secondary data source when performing a lookup transformation. Each tuple should be a name of a field to return followed by the new name to give it. Unlike luAs this allows separate aliases to be given to each matched field.

luFieldsAsWithDefault : List ( String, String ) -> String -> LookupFields

The same as luFieldsAs except with a second parameter providing the default value if the lookup fails.

luAs : String -> LookupFields

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 ]

luAsWithDefault : String -> String -> LookupFields

The same as luAs except with a second parameter providing the default value if the lookup fails.

3.10 Data Imputation

Impute missing data. See the Vega-Lite impute documentation.

impute : String -> String -> List ImputeProperty -> List LabelledSpec -> List LabelledSpec

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 [] ]

imFrame : Maybe Basics.Int -> Maybe Basics.Int -> ImputeProperty

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.

imKeyVals : DataValues -> ImputeProperty

Key values to be considered for imputation. Used by pImpute.

imKeyValSequence : Basics.Float -> Basics.Float -> Basics.Float -> ImputeProperty

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.

imMethod : ImMethod -> ImputeProperty

Imputation method to use when replacing values. Used by pImpute.

imGroupBy : List String -> ImputeProperty

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.

imNewValue : DataValue -> ImputeProperty

New value to use when imputing with imValue. Used by pImpute.

imValue : ImMethod

Use field value when imputing missing data. Used by imMethod.

imMean : ImMethod

Use mean of values when imputing missing data. Used by imMethod.

imMedian : ImMethod

Use median of values when imputing missing data. Used by imMethod.

imMax : ImMethod

Use maximum of values when imputing missing data. Used by imMethod.

imMin : ImMethod

Use maximum of values when imputing missing data. Used by imMethod.

3.11 Data Sampling

See the Vega-Lite sample documentation

sample : Basics.Float -> List LabelledSpec -> List LabelledSpec

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 50

3.12 Extent Calculation

extent : String -> String -> List LabelledSpec -> List LabelledSpec

Find the extent (minimum and maximum) of a given field (first parameter) and store it as a named parameter (second parameter). The stored value will be a two-element array with values that may be extracted in an expression. For example,

trans =
    transform << extent "age" "ageExtent"

encMin =
    encoding
        << position X [ pDatum (datumExpr "ageExtent[0]"), pQuant ]

encMax =
    encoding
        << position X [ pDatum (datumExpr "ageExtent[1]"), pQuant ]

3.13 Density Estimation

See the Vega-Lite density documentation

density : String -> List DensityProperty -> List LabelledSpec -> List LabelledSpec

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.

dnGroupBy : List String -> DensityProperty

The data fields to group by when estimating density. If not specified, a single group containing all data objects will be used.

dnCumulative : Basics.Bool -> DensityProperty

Whether or not density estimates will be cumulative. If unspecified, non-cumulative estimates will be generated.

dnCounts : Basics.Bool -> DensityProperty

Whether density estimates should generate counts (true) or probabilities (false). If unspecified, probabilities will be generated.

dnBandwidth : Basics.Float -> DensityProperty

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.

dnExtent : Basics.Float -> Basics.Float -> DensityProperty

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.

dnMinSteps : Basics.Int -> DensityProperty

The minimum number of samples to take from the extent domain when estimating density. Default is 25.

dnMaxSteps : Basics.Int -> DensityProperty

The maximum number of samples to take when estimating density. Default is 200.

dnSteps : Basics.Int -> DensityProperty

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.

dnAs : String -> String -> DensityProperty

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.

3.14 Loess Trend Calculation

See the Vega-Lite loess documentation

loess : String -> String -> List LoessProperty -> List LabelledSpec -> List LabelledSpec

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.

lsGroupBy : List String -> LoessProperty

The data fields to group by when generating a loess trendline. If not specified, a single group containing all data objects will be used.

lsBandwidth : Basics.Float -> LoessProperty

The bandwidth scaled between [0,1] to determine the amount of loess smoothing. Default value is 0.3

lsAs : String -> String -> LoessProperty

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.

3.15 Regression Calculation

See the Vega-Lite regression documentation

regression : String -> String -> List RegressionProperty -> List LabelledSpec -> List LabelledSpec

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.

rgGroupBy : List String -> RegressionProperty

The data fields to group by when generating a regression model. If not specified, a single group containing all data objects will be used.

rgMethod : RegressionMethod -> RegressionProperty

The type of regression model to use when generating a 2d regression. Used by rgMethod.

rgOrder : Basics.Int -> RegressionProperty

The order of a polynomial model to use when generating a 2d regression. Only applies if rgMethod is set to rgPoly.

rgExtent : Basics.Float -> Basics.Float -> RegressionProperty

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.

rgParams : Basics.Bool -> RegressionProperty

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.

rgAs : String -> String -> RegressionProperty

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.

rgLinear : RegressionMethod

Indicate a linear regression method. Used by rgMethod.

rgLog : RegressionMethod

Indicate a log regression method. Used by rgMethod.

rgExp : RegressionMethod

Indicate an exponential regression method. Used by rgMethod.

rgPow : RegressionMethod

Indicate a power regression method. Used by rgMethod.

rgQuad : RegressionMethod

Indicate a quadratic regression method. Used by rgMethod.

rgPoly : RegressionMethod

Indicate a polynomial regression method. The order of the polynomial can be set with rgOrder (defaulting to cubic if not provided). Used by rgMethod.

3.16 Quantile Calculation

quantile : String -> List QuantileProperty -> List LabelledSpec -> List LabelledSpec

Calculate quantile values from an input data stream. Useful for examining distributional properties of a data stream and for creating Q-Q plots.

qtGroupBy : List String -> QuantileProperty

The data fields to group by when performing a quantile transformation. If not specified, a single group containing all data objects will be used.

qtProbs : List Basics.Float -> QuantileProperty

A list of probabilities in the range [0,1] for which to compute quantile values. If not specified, the default step size of 0.01 or the value specified via qtStep will be used.

qtStep : Basics.Float -> QuantileProperty

The interval between probabilities to use when performing a quantile transformation. All values from half the given step size to 1 will be sampled. Only used if qtProbs is not specified.

qtAs : String -> String -> QuantileProperty

The field names to give the probability and associated quantile values generated by a quantile transformation. If not specified, prob and value are used.

3.17 Window Transformations

See the Vega-Lite window transform field and window transform documentation.

window : List ( List Window, String ) -> List WindowProperty -> List LabelledSpec -> List LabelledSpec

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 ]

wiAggregateOp : Operation -> Window

An aggregate operation to be used in a window transformation. For example,

transform
    << window [ ( [ wiAggregateOp opSum, wiField "Time" ], "TotalTime" ) ]
        [ wiFrame Nothing Nothing ]

wiOp : WOperation -> Window

Window-specific operation to be used in a window transformation.

wiParam : Basics.Int -> Window

Numeric parameter for window-only operations that can be parameterised (woPercentile, woLag, woLead and woNthValue).

wiField : String -> Window

Field for which to compute a window operation. Not needed for operations that do not apply to fields such as opCount, woRank and woDenseRank.

woRowNumber : WOperation

Assign consecutive row number to values in a data object to be applied in a window transform. Used by wiOp.

woRank : WOperation

Rank opertation to be applied in a window transform. Used by wiOp.

woDenseRank : WOperation

Dense rank operation to be applied in a window transform. Used by wiOp.

woPercentRank : WOperation

Percentile of values in a sliding window be applied in a window transform. Used by wiOp.

woCumeDist : WOperation

Cumulative distribution operation to be applied in a window transformation. Used by wiOp.

woPercentile : WOperation

Value preceding the current object in a sliding window to be applied in a window transform. Used by wiOp.

woLag : WOperation

Value preceding the current object in a sliding window to be applied in a window transform. Used by wiOp.

woLead : WOperation

Value following the current object in a sliding window to be applied in a window transform. Used by wiOp.

woFirstValue : WOperation

First value in a sliding window to be applied in a window transform. Used by wiOp.

woLastValue : WOperation

Last value in a sliding window to be applied in a window transform. Used by wiOp.

woNthValue : WOperation

Nth value in a sliding window to be applied in a window transform. Used by wiOp.

wiFrame : Maybe Basics.Int -> Maybe Basics.Int -> WindowProperty

Moving window for use by a window transform. 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.

wiIgnorePeers : Basics.Bool -> WindowProperty

Whether or not the sliding window frame in a window transform should ignore peer values (those considered identical by the sort criteria).

wiGroupBy : List String -> WindowProperty

Fields for partitioning data objects in a window transform into separate windows. If unspecified, all points will be in a single group.

wiSort : List SortField -> WindowProperty

Comparator for sorting data objects within a window transform.

wiAscending : String -> SortField

Indicate that the given field should be sorted in ascending order when performing a window transform. Used by wiSort.

wiDescending : String -> SortField

Indicate that the given field should be sorted in descending order when performing a window transform. Used by wiSort.

4. Specifying Marks

Functions for declaring the type of visual marks used to represent encoded data.

4.1 Types of Mark

arc : List MarkProperty -> ( VLProperty, Spec )

Arc mark for radial plots such as pie charts or rose diagrams.

area : List MarkProperty -> ( VLProperty, Spec )

An area mark for representing a series of data elements, such as in a stacked area chart or streamgraph.

bar : List MarkProperty -> ( VLProperty, Spec )

Bar mark for histograms, bar charts etc.

boxplot : List MarkProperty -> ( VLProperty, Spec )

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 : List MarkProperty -> ( VLProperty, Spec )

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 : List MarkProperty -> ( VLProperty, Spec )

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 : List MarkProperty -> ( VLProperty, Spec )

Circle mark for symbolising points. Unlike the point mark, circles are filled by default and may be sized via a separate size encoding.

geoshape : List MarkProperty -> ( VLProperty, Spec )

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 : List MarkProperty -> ( VLProperty, Spec )

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 : List MarkProperty -> ( VLProperty, Spec )

Line mark for symbolising a sequence of values.

point : List MarkProperty -> ( VLProperty, Spec )

Point mark for symbolising a data point with a symbol.

rect : List MarkProperty -> ( VLProperty, Spec )

Rectangle mark.

rule : List MarkProperty -> ( VLProperty, Spec )

Rule line connecting two vertices.

square : List MarkProperty -> ( VLProperty, Spec )

Square mark for symbolising points.

textMark : List MarkProperty -> ( VLProperty, Spec )

Text mark to be displayed at some point location.

tick : List MarkProperty -> ( VLProperty, Spec )

Short line (tick) mark for symbolising point locations.

trail : List MarkProperty -> ( VLProperty, Spec )

Trail mark (line with variable width along its length).

4.2 Mark Properties

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.

maBooExpr : String -> (Basics.Bool -> MarkProperty) -> MarkProperty

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 ]

maNumExpr : String -> (number -> MarkProperty) -> MarkProperty

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 ]

maNumsExpr : String -> (List number -> MarkProperty) -> MarkProperty

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"
            [ paValues (nums [ 2, 2 ])
            , paBind (ipSelect [ inDataOptions [ nums [ 2, 2 ], nums [ 8, 8 ] ] ])
            ]

mk =
    bar
        [ maNumsExpr "dashStyle" maStrokeDash, maStroke "black" ]

maStrExpr : String -> (String -> MarkProperty) -> MarkProperty

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 ]

maAlign : HAlign -> MarkProperty

Horizontal alignment of a textMark.

maAngle : Basics.Float -> MarkProperty

Rotation angle of a textMark (degrees from horizontal).

maAria : List Aria -> MarkProperty

ARIA properties for providing accessible SVG output associated with a mark such as bar or line. If an empty list is provided, ARIA tagging will be switched off.

maBandSize : Basics.Float -> MarkProperty

Band size of a bar mark.

maBaseline : VAlign -> MarkProperty

Vertical alignment of a textMark.

maBinSpacing : Basics.Float -> MarkProperty

Offset between bars for a binned field using a bar mark.

maBlend : BlendMode -> MarkProperty

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.

maBorders : List MarkProperty -> MarkProperty

Border properties for an errorband mark.

maBox : List MarkProperty -> MarkProperty

Box symbol properties for the boxplot mark. If an empty list is provided, no box will be shown.

maClip : Basics.Bool -> MarkProperty

Whether or not a mark such as bar or line should be clipped to the enclosing group's dimensions.

maRemoveInvalid : Basics.Bool -> MarkProperty

Determine whether or not invalid (null and NaN) values are considered for encoding as marks such as bar or point. If true (default), invalid values are ignored, otherwise they are treated as if 0.

maColor : String -> MarkProperty

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

maColorGradient : ColorGradient -> List GradientProperty -> MarkProperty

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

maCornerRadius : Basics.Float -> MarkProperty

The radius in pixels of selected marks' corners. For rectangular marks such as bar, it shapes all four corners; for arc marks it shapes the vertices of segment. Default is 0 indicating no rounding.

maCornerRadiusEnd : Basics.Float -> MarkProperty

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.

maCornerRadiusTopLeft : Basics.Float -> MarkProperty

The radius in pixels of the top-left corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.

maCornerRadiusTopRight : Basics.Float -> MarkProperty

The radius in pixels of the top-right corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.

maCornerRadiusBottomLeft : Basics.Float -> MarkProperty

The radius in pixels of the bottom-left corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.

maCornerRadiusBottomRight : Basics.Float -> MarkProperty

The radius in pixels of the bottom-right corner of a rectangular mark such as bar. Will override any value specified in maCornerRadius.

maCursor : Cursor -> MarkProperty

Cursor to be associated with a hyperlink mark.

maExtent : SummaryExtent -> MarkProperty

Extent of whiskers used in a boxplot, errorbar or errorband.

maHRef : String -> MarkProperty

Hyperlink to be associated with a mark such as a circle making it a clickable hyperlink.

maContinuousBandSize : Basics.Float -> MarkProperty

Continuous band size of a bar mark.

maDiscreteBandSize : Basics.Float -> MarkProperty

Discrete band size of a bar mark.

maMinBandSize : Basics.Float -> MarkProperty

Mimimum band size of a bar or rect mark. Can be useful in a limited screen space where bars need a visible width but can overlap.

maLimit : Basics.Float -> MarkProperty

Width in pixels indicating maximum permitted space for a [textMark](#textMark Any mark that exceeds this limit will be truncated with an ellipsis.

maDir : TextDirection -> MarkProperty

Direction of text in a textMark, which determines which end is truncated in cases where text is larger than available space.

maEllipsis : String -> MarkProperty

Text to indicate a truncated piece of a textMark. Default is the ellipsis ...

maDx : Basics.Float -> MarkProperty

Horizontal offset between a textMark and its anchor.

maDy : Basics.Float -> MarkProperty

Vertical offset between a textMark mark and its anchor.

maInnerRadius : Basics.Float -> MarkProperty

Fix the inner radius (R2) of a radial plot using an arc mark. Can be used for creating 'holes' in pie chart.

maOuterRadius : Basics.Float -> MarkProperty

Fix the outer radius (R) of a radial plot using an arc mark.

maPadAngle : Basics.Float -> MarkProperty

Angular padding applied to sides of an arc mark (in radians).

maFill : String -> MarkProperty

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.

maFillGradient : ColorGradient -> List GradientProperty -> MarkProperty

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.

maFilled : Basics.Bool -> MarkProperty

Whether or not a mark's color should be used as the fill color instead of stroke color. Used by mark functions such as bar and circle.

maFillOpacity : Basics.Float -> MarkProperty

Fill opacity of a mark such as bar or circle.

maFont : String -> MarkProperty

Font of a textMark. Can be any font name made accessible via a css file (or a generic font like serif, monospace etc.).

maFontSize : Basics.Float -> MarkProperty

Font size in pixels used by a textMark.

maFontStyle : String -> MarkProperty

Font style (e.g. italic) used by a textMark.

maFontWeight : FontWeight -> MarkProperty

Font weight used by a textMark.

maInterpolate : MarkInterpolation -> MarkProperty

Interpolation method used by line and area marks. For example, to create a curved line joining data points:

line [ maInterpolate miMonotone ]

maOpacity : Basics.Float -> MarkProperty

Overall opacity of a mark such as bar or line in the range 0 (completely transparent) to 1 (completely opaque).

maOrder : Basics.Bool -> MarkProperty

Ordering of vertices in a line or area mark. If true (default), order is determined by measurement type or order channel. If false, the original data order is used.

maOrient : MarkOrientation -> MarkProperty

Orientation of a non-stacked bar, tick, area or line mark.

maPoint : PointMarker -> MarkProperty

Appearance of a point marker joining the vertices of a line or area mark.

line [ maPoint (pmMarker [ maFill "black" ]) ]

maLine : LineMarker -> MarkProperty

Appearance of a line marker joining the vertices of an area mark. For example,

area
    [ maLine (lmMarker [ maStroke "black" ])
    , maInterpolate miMonotone
    ]

maMedian : List MarkProperty -> MarkProperty

Median line properties for the boxplot mark. If an empty list is provided, no median line will be shown.

maOutliers : List MarkProperty -> MarkProperty

Outlier symbol properties for the boxplot mark. If an empty list is provided, no outliers will be shown.

maRadius : Basics.Float -> MarkProperty

Radial offset of a textMark from an origin specified in Cartesian X and Y coordinates.

maRule : List MarkProperty -> MarkProperty

Rule (main line) properties for the errorbar and boxplot marks. If an empty list is provided, no rule will be shown.

maShape : Symbol -> MarkProperty

Shape of a point mark.

maShortTimeLabels : Basics.Bool -> MarkProperty

Whether or not month and weekday names are abbreviated in a textMark.

maSize : Basics.Float -> MarkProperty

Size of a mark such as a circle or square in square units. For example, to create a circle of diameter 50 pixels:

circle [ maSize 2500 ]

maStroke : String -> MarkProperty

Default stroke color of a mark such as circle or bar. Color strings can use any valid HTML color specification.

maStroke "#eee"

maStroke "#734FD8"

maStroke "crimson"

maStroke "rgb(255,204,210)"

maStroke "hsl(180, 50%, 50%)"

An empty string ("") indicates that no stroke around a mark be drawn.

maStrokeGradient : ColorGradient -> List GradientProperty -> MarkProperty

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.

Used by mark functions such as bar and line.

maStrokeCap : StrokeCap -> MarkProperty

Cap style of a mark's stroke. Used by mark functions such as point and line.

caRound : StrokeCap

Rounded stroke cap. Used by maStrokeCap, axDomainCap, axcoDomainCap, axTickCap, axcoTickCap, axGridCap, axcoGridCap, viewStrokeCap and vicoStrokeCap.

caSquare : StrokeCap

Square stroke cap. Used by maStrokeCap, axDomainCap, axcoDomainCap, axTickCap, axcoTickCap, axGridCap, axcoGridCap, viewStrokeCap and vicoStrokeCap.

caButt : StrokeCap

Butt stroke cap. Used by maStrokeCap, axDomainCap, axcoDomainCap, axTickCap, axcoTickCap, axGridCap, axcoGridCap, viewStrokeCap and vicoStrokeCap.

caExpr : String -> StrokeCap

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.

maStrokeDash : List Basics.Float -> MarkProperty

Stroke dash style used by a mark such as circle or line. Determined by an alternating 'on-off' sequence of line lengths.

maStrokeDashOffset : Basics.Float -> MarkProperty

Number of pixels before the first line dash is drawn in a mark such as line.

maStrokeJoin : StrokeJoin -> MarkProperty

Line segment join style of a mark's stroke. Used by mark functions such as point and line.

joRound : StrokeJoin

Rounded stroke join. Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.

joBevel : StrokeJoin

Bevelled stroke join. Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.

joMiter : StrokeJoin

Mitred stroke join. Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.

joExpr : String -> StrokeJoin

Expression that evaluates to some stroke join style such as "bevel", "miter" or "round". Used by maStrokeJoin, viewStrokeJoin and vicoStrokeJoin.

maStrokeMiterLimit : Basics.Float -> MarkProperty

Mitre limit at which to bevel a join between line segments of a mark's stroke. Used by mark functions such as point and line.

maStrokeOpacity : Basics.Float -> MarkProperty

Stroke opacity of a mark in the range 0 to 1. Used by mark functions such as circle or bar.

maStrokeWidth : Basics.Float -> MarkProperty

Stroke width of a mark in pixel units. Used by mark functions such as circle or bar.

maStyle : List String -> MarkProperty

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.

maTension : Basics.Float -> MarkProperty

Interpolation tension used when interpolating line and area marks.

maText : String -> MarkProperty

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.

maLineHeight : Basics.Float -> MarkProperty

Line height for a multi-line textMark.

maTheta : Basics.Float -> MarkProperty

Polar coordinate angle (clockwise from north in radians) of an arc or textMark. If a text mark it represents polar coordinate angle relative to an origin determined by its x and y properties. For an arc mark it is its length in radians or, when combined with maTheta2, the arc's start angle.

maTheta2 : Basics.Float -> MarkProperty

Polar coordinate angle (clockwise from north in radians) of the end of an arc mark.

maThickness : Basics.Float -> MarkProperty

Thickness of a tick mark.

maTicks : List MarkProperty -> MarkProperty

Tick properties for the errorbar or boxplot mark.

maTooltip : TooltipContent -> MarkProperty

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 ]

maUrl : String -> MarkProperty

An image mark's URL.

maWidth : Basics.Float -> MarkProperty

Explicitly set the width of a mark such as a bar.

maWidthBand : Basics.Float -> MarkProperty

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 ]

maHeight : Basics.Float -> MarkProperty

Explicitly set the height of a mark such as rect.

maHeightBand : Basics.Float -> MarkProperty

Set the height of a bar mark as a proportion of its band size.

maX : Basics.Float -> MarkProperty

X position of a mark such as a point or square.

maY : Basics.Float -> MarkProperty

Y position of a mark such as rect or [rule][#rule].

maXOffset : Basics.Float -> MarkProperty

X position offset for a mark such as textMark.

maYOffset : Basics.Float -> MarkProperty

Y position offset for a mark such as textMark.

maThetaOffset : Basics.Float -> MarkProperty

Clockwise angular offset (in radians) of a radially positioned mark such as an arc.

maTheta2Offset : Basics.Float -> MarkProperty

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.

maX2 : Basics.Float -> MarkProperty

X2 position (secondary x value for linear marks such as rule and areal marks such as rect).

maY2 : Basics.Float -> MarkProperty

Y2 position (secondary y value for linear marks such as rule and areal marks such as rect).

maX2Offset : Basics.Float -> MarkProperty

X2 position offset for a mark such as rect or [rule][#rule].

maY2Offset : Basics.Float -> MarkProperty

Y2 position offset for a mark.

maRadiusOffset : Basics.Float -> MarkProperty

Polar coordinate radial offset of a textMark or arc mark from a polar origin specified with Theta and R.

maRadius2Offset : Basics.Float -> MarkProperty

Polar coordinate inner radial offset of an arc mark from a polar origin specified with Theta, R and R2.

maAspect : Basics.Bool -> MarkProperty

Whether or not the aspect ratio of an image mark should be preserved.

4.2.1 Color Gradients

grLinear : ColorGradient

Indicate a linear color gradient. See the Vega-Lite color gradient documentation. Used by maColorGradient, maFillGradient and maStrokeGradient.

grRadial : ColorGradient

Indicate a radial color gradient. See the Vega-Lite color gradient documentation. Used by maColorGradient, maFillGradient and maStrokeGradient.

grX1 : Basics.Float -> GradientProperty

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.

grX2 : Basics.Float -> GradientProperty

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.

grY1 : Basics.Float -> GradientProperty

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.

grY2 : Basics.Float -> GradientProperty

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.

grR1 : Basics.Float -> GradientProperty

The radius, normalised to [0, 1], of the inner circle for a radial color gradient. Default is 0. Used by maColorGradient, maFillGradient and maStrokeGradient.

grR2 : Basics.Float -> GradientProperty

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.

grStops : List ( Basics.Float, String ) -> GradientProperty

Color interpolation points. Each tuple in the list is a position normalised [0, 1] and its associated color. Used by maColorGradient, maFillGradient and maStrokeGradient.

4.2.2 Used by Mark Properties

arEnable : Aria

Enable ARIA attributes when generating SVG output. Default is that Aria is enabled, so this is only useful when overriding more global disabling of Aria attributes. Used by maAria, axAria, axcoAria, leAria and lecoAria.

arDisable : Aria

Disable ARIA attributes when generating SVG output. Default is that Aria is enabled. Used by maAria, axAria, axcoAria, leAria and lecoAria.

arDescription : String -> Aria

Description to be provided in ARIA tag when generating SVG output. If not specified, the an auto-generated description will be provided. Used by maAria, axAria, axcoAria, leAria and lecoAria.

arExpr : String -> Aria

Set ARIA attributes with the the given expression. Used by maAria, axAria, axcoAria, leAria and lecoAria. For example,

params
    << param "barDesc"
        [ paValue (dataObject [ ( "description", str "Bar chart bar" ) ]) ]

bar [ maAria [ arExpr "barDesc" ] ]

moHorizontal : MarkOrientation

Indicate horizontal mark orientation. Used by maOrient, leDirection, lecoDirection, lecoGradientDirection and lecoSymbolDirection.

moVertical : MarkOrientation

Indicate vertical mark orientation. Used by maOrient, leDirection, lecoDirection, lecoGradientDirection and lecoSymbolDirection.

miBasis : MarkInterpolation

Cubic basis spline interpolation between points anchored at first and last points. Used by maInterpolate.

miBasisOpen : MarkInterpolation

Open cubic basis spline interpolation between points, which may not intersect first and last points. Used by maInterpolate.

miBasisClosed : MarkInterpolation

Closed cubic basis spline interpolation between points forming a polygon. Used by maInterpolate.

miBundle : MarkInterpolation

Bundle curve interpolation between points.

miCardinal : MarkInterpolation

Cubic cardinal spline interpolation between points anchored at first and last points. Used by maInterpolate.

miCardinalOpen : MarkInterpolation

Open cubic cardinal spline interpolation between points, which may not intersect first and last points. Used by maInterpolate.

miCardinalClosed : MarkInterpolation

Closed cubic cardinal spline interpolation between points forming a polygon. Used by maInterpolate.

miLinear : MarkInterpolation

Linear (straight) interpolation between points. Used by maInterpolate.

miLinearClosed : MarkInterpolation

Linear (straight) interpolation between points that joins the first and last points in a sequence to form a closed polygon. Used by maInterpolate.

miMonotone : MarkInterpolation

Cubic spline interpolation that preserves monotonicity between points. Used by maInterpolate.

miStepwise : MarkInterpolation

Piecewise (stepped) constant interpolation function centred on each point in a sequence. Used by maInterpolate.

miStepAfter : MarkInterpolation

Piecewise (stepped) constant interpolation function after each point in a sequence. Used by maInterpolate.

miStepBefore : MarkInterpolation

Piecewise (stepped) constant interpolation function before each point in a sequence. Used by maInterpolate.

miExpr : String -> MarkInterpolation

Expression that evaluates to some interpolation method such as "linear", "basis" or "monotone". Used by maInterpolate.

tdLeftToRight : TextDirection

Indicate a left-to-right text direction.

tdRightToLeft : TextDirection

Indicate a right-to-left text direction.

tdExpr : String -> TextDirection

Expression that evaluates to a text direction "ltr" (left-to-right) or 'rtl' (right-to-left) .

symCircle : Symbol

Specify a circular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symCross : Symbol

Specify a cross symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symDiamond : Symbol

Specify a diamond symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symSquare : Symbol

Specify a square symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symTriangleUp : Symbol

Specify an upward triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symTriangleDown : Symbol

Specify a downward triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symTriangleLeft : Symbol

Specify a leftward facing triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symTriangleRight : Symbol

Specify a rightward facing triangular symbol for a shape mark. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symPath : String -> Symbol

A custom symbol shape as an SVG path description. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symStroke : Symbol

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.

symArrow : Symbol

Specify a centred arrow symbol for a shape mark. Useful for vector plots. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symWedge : Symbol

Specify a centred wedge (thin triangle) symbol for a shape mark. Useful for vector plots. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symTriangle : Symbol

Specify a centred triangle symbol for a shape mark. Useful for vector plots. Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

symExpr : String -> Symbol

Expression that evaluates to some symbol such as "diamond", "cross" or "circle". Used by maShape, mSymbol, leSymbolType, lecoSymbolType and racoSymbols.

pmNone : PointMarker

No point marker to be shown on a line or area mark. Used by maPoint.

pmTransparent : PointMarker

Transparent point marker to be placed on area or line mark. Useful for interactive selections. Used by maPoint.

pmMarker : List MarkProperty -> PointMarker

Properties of a point marker that is overlaid on a line or area mark. Used when specifying an maPoint.

lmMarker : List MarkProperty -> LineMarker

Properties of a line marker that is overlaid on an area mark. Used when specifying an maLine.

lmNone : LineMarker

Indicate no line marker on an area mark. Used when specifying an maLine.

exRange : SummaryExtent

Band extent between the minimum and maximum values in a distribution. Used by maExtent.

exCi : SummaryExtent

Band extent between the 95% confidence intervals of a distribution. Used by maExtent.

exIqr : SummaryExtent

Band extent between the lower and upper quartiles of a distribution. Used by maExtent.

exIqrScale : Basics.Float -> SummaryExtent

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.

exStderr : SummaryExtent

Band extent as the standard error about the mean of a distribution. Used by maExtent.

exStdev : SummaryExtent

Band extent as the standard deviation of a distribution. Used by maExtent.

ttData : TooltipContent

Indicate tooltips are generated by all fields in the underlying data. Used by maTooltip. For example,

circle [ maTooltip ttData ]

ttEncoding : TooltipContent

Indicate tooltips should be enabled using the encoded data of the mark. Used by maTooltip. For example,

circle [ maTooltip ttEncoding ]

ttNone : TooltipContent

Indicate that tooltips should be disabled for the mark (default). Used by maTooltip. For example,

circle [ maTooltip ttNone ]

4.2.3 Blend Modes

bmNormal : BlendMode

Indicate the default blend mode should be applied when drawing over some background. Used by maBlend.

bmMultiply : BlendMode

Multiplicative blend mode to be applied when drawing over some background. Used by maBlend.

bmScreen : BlendMode

Screen blend mode to be applied when drawing over some background. Used by maBlend.

bmOverlay : BlendMode

Overlay blend mode to be applied when drawing over some background. Used by maBlend.

bmDarken : BlendMode

Darken blend mode to be applied when drawing over some background.

bmLighten : BlendMode

Lighten blend mode to be applied when drawing over some background. Used by maBlend.

bmColorDodge : BlendMode

Color dodge blend mode to be applied when drawing over some background.

bmColorBurn : BlendMode

Color burn blend mode to be applied when drawing over some background.

bmHardLight : BlendMode

Hard light blend mode to be applied when drawing over some background. Used by maBlend.

bmSoftLight : BlendMode

Soft light blend mode to be applied when drawing over some background. Used by maBlend.

bmDifference : BlendMode

Difference blend mode to be applied when drawing over some background. Used by maBlend.

bmExclusion : BlendMode

Exclusion blend mode to be applied when drawing over some background. Used by maBlend.

bmHue : BlendMode

Hue blend mode to be applied when drawing over some background. Used by maBlend.

bmSaturation : BlendMode

Saturation blend mode to be applied when drawing over some background. Used by maBlend.

bmColor : BlendMode

Color blend mode to be applied when drawing over some background.

bmLuminosity : BlendMode

Luminosity blend mode to be applied when drawing over some background. Used by maBlend.

bmExpr : String -> BlendMode

Expression that evaluates to some blend mode such as "darken", "hue" or "luminosity". Used by maBlend.

4.2.4 Cursors

See the CSS cursor documentation

cuAuto : Cursor

Automatically determine a cursor type depending on interaction context. Used by maCursor, smCursor and vicoCursor.

cuDefault : Cursor

Default cursor. Used by maCursor, smCursor and vicoCursor.

cuNone : Cursor

No cursor. Used by maCursor, smCursor and vicoCursor.

cuContextMenu : Cursor

Context menu cursor. Used by maCursor, smCursor and vicoCursor.

cuHelp : Cursor

Help cursor. Used by maCursor, smCursor and vicoCursor.

cuPointer : Cursor

Pointer cursor. Used by maCursor, smCursor and vicoCursor.

cuProgress : Cursor

Progress cursor. Used by maCursor, smCursor and vicoCursor.

cuWait : Cursor

Waiting cursor. Used by maCursor, smCursor and vicoCursor.

cuCell : Cursor

Cell cursor. Used by maCursor, smCursor and vicoCursor.

cuCrosshair : Cursor

Crosshair cursor. Used by maCursor, smCursor and vicoCursor.

cuText : Cursor

Text cursor. Used by maCursor, smCursor and vicoCursor.

cuVerticalText : Cursor

Vertical text cursor. Used by maCursor, smCursor and vicoCursor.

cuAlias : Cursor

Alias cursor. Used by maCursor, smCursor and vicoCursor.

cuCopy : Cursor

Copy cursor. Used by maCursor, smCursor and vicoCursor.

cuMove : Cursor

Move cursor. Used by maCursor, smCursor and vicoCursor.

cuNoDrop : Cursor

'No drop' cursor. Used by maCursor, smCursor and vicoCursor.

cuNotAllowed : Cursor

'Not allowed' cursor. Used by maCursor, smCursor and vicoCursor.

cuAllScroll : Cursor

Scrolling cursor. Used by maCursor, smCursor and vicoCursor.

cuColResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuRowResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuNResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuEResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuSResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuWResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuNEResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuNWResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuSEResize : Cursor

Resizing cursor.

cuSWResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuEWResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuNSResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuNESWResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuNWSEResize : Cursor

Resizing cursor. Used by maCursor, smCursor and vicoCursor.

cuZoomIn : Cursor

Zooming cursor. Used by maCursor, smCursor and vicoCursor.

cuZoomOut : Cursor

Zooming cursor. Used by maCursor, smCursor and vicoCursor.

cuGrab : Cursor

Grab cursor. Used by maCursor, smCursor and vicoCursor.

cuGrabbing : Cursor

Grabbing cursor. Used by maCursor, smCursor and vicoCursor.

cuExpr : String -> Cursor

Expression that evaluates to some cursor style such as "crosshair", "grab" or "help". Used by maCursor, smCursor and vicoCursor.

5. Encoding Data as Channels

Describes the mapping between data fields and the channels (position, color etc.) used to determine the visual appearance of marks that represent them.

encoding : List LabelledSpec -> ( VLProperty, Spec )

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 Measurement

Type of measurement to be associated with some channel.

5.1 Position channel

Relates to where something appears in the visualization. See the Vega-Lite position documentation

position : Position -> List PositionChannel -> List LabelledSpec -> List LabelledSpec

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 Position
    = X
    | Y
    | X2
    | Y2
    | XOffset
    | YOffset
    | Theta
    | Theta2
    | R
    | R2
    | Longitude
    | Latitude
    | Longitude2
    | Latitude2
    | XError
    | YError
    | XError2
    | YError2

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.

5.1.1 Position Channel Properties

pName : String -> PositionChannel

Name of field used for encoding with a position channel.

pDatum : DataValue -> PositionChannel

Set a position to an arbitrary data value. Useful for placing items at the specific points in the data space. To place in data screen space, use pNum.

pRepeat : Arrangement -> PositionChannel

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
    ]

pRepeatDatum : Arrangement -> PositionChannel

Reference in a position channel to a datum value generated by repeat.

pNominal : PositionChannel

Indicate a data field encoded as a position is nominal. This is the default data type.

pOrdinal : PositionChannel

Indicate a data field encoded as a position is ordinal.

pQuant : PositionChannel

Indicate a data field encoded as a position is quantitative. This is not necessary when field is aggregated by a numeric operator (e.g. opSum), scaled with a numeric operator (e.g. scLog), a position field is longitude/latitude or it is binned numerically.

pTemporal : PositionChannel

Indicate a data field encoded as a position is temporal. This is not necessary if the field is aggregated with a time unit (e.g. pTimeUnit) or scaled with scTime or scUtc.

pGeo : PositionChannel

Indicate a data field encoded as a position is a geo feature.

pBin : List BinProperty -> PositionChannel

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 ]

pBinned : PositionChannel

Indicate that data encoded with position are already binned.

pTimeUnit : TimeUnit -> PositionChannel

Form of time unit aggregation of field values when encoding with a position channel.

pTitle : String -> PositionChannel

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.

pAggregate : Operation -> PositionChannel

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 ]

pScale : List ScaleProperty -> PositionChannel

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 ] ]

pAxis : List AxisProperty -> PositionChannel

Axis properties used when encoding with a position channel. For no axis, provide an empty list.

pSort : List SortProperty -> PositionChannel

Sort order for field when encoding with a position channel.

pBandPosition : Basics.Float -> PositionChannel

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.

pStack : StackOffset -> PositionChannel

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 ]

pWidth : PositionChannel

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 ]

pHeight : PositionChannel

Set the position to the height of the enclosing data space. Useful for placing a mark relative to the bottom edge of a view.

pNum : Basics.Float -> PositionChannel

Set a position to an arbitrary value. Useful for placing items at the top of a plot area (pNum 0) or a fixed number of pixels from the top. To place in data sspace rather than screen space, use pDatum.

pImpute : List ImputeProperty -> PositionChannel

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 [] ]

5.1.2 Sorting Properties

See the Vega-Lite sort documentation.

soAscending : SortProperty

Indicate sorting is to be applied from low to high.

soDescending : SortProperty

Indicate sorting is to be applied from high to low.

soByField : String -> Operation -> SortProperty

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 ]
    ]

soByChannel : Channel -> SortProperty

Sort by another channel. Used by pSort, mSort, oSort and fSort. For example,

position Y [ pName "age", pOrdinal, pSort [ soByChannel chX ] ]

soByRepeat : Arrangement -> Operation -> SortProperty

Sort by the aggregated summaries of the given fields (referenced by a repeat iterator) using a given aggregation operation. Used by pSort, mSort, oSort and fSort.

soCustom : DataValues -> SortProperty

Custom sort order listing data values explicitly. Used by pSort, mSort, oSort and fSort.

5.1.3 Axis Properties

See the Vega-Lite axis property documentation

axBooExpr : String -> (Basics.Bool -> AxisProperty) -> AxisProperty

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 ]
            ]

axcoBooExpr : String -> (Basics.Bool -> AxisConfig) -> AxisConfig

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.

axNumExpr : String -> (number -> AxisProperty) -> AxisProperty

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 ]
            ]

axcoNumExpr : String -> (number -> AxisConfig) -> AxisConfig

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.

axNumsExpr : String -> (List number -> AxisProperty) -> AxisProperty

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"
            [ paValues (nums [ 2, 2 ])
            , paBind (ipSelect [ inDataOptions [ nums [ 2, 2 ], nums [ 8, 8 ] ] ])
            ]

enc =
    encoding
        << position X [ pAxis [ axNumsExpr "gridDash" axGridDash ] ]

axcoNumsExpr : String -> (List number -> AxisConfig) -> AxisConfig

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.

axStrExpr : String -> (String -> AxisProperty) -> AxisProperty

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 ]
            ]

axcoStrExpr : String -> (String -> AxisConfig) -> AxisConfig

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.

General

axAria : List Aria -> AxisProperty

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 pAxis.

axBandPosition : Basics.Float -> AxisProperty

Position of axis tick relative to a band (0 to 1). Used by pAxis.

axMaxExtent : Basics.Float -> AxisProperty

Maximum extent in pixels that axis ticks and labels should use. Used by pAxis.

axMinExtent : Basics.Float -> AxisProperty

Minimum extent in pixels that axis ticks and labels should use. Used by pAxis.

axOrient : Side -> AxisProperty

Orientation of an axis relative to the plot it is describing. Used by pAxis.

axOffset : Basics.Float -> AxisProperty

Offset to displace the axis from the edge of the enclosing group or data rectangle. Used by pAxis.

axPosition : Basics.Float -> AxisProperty

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.

axZIndex : Basics.Int -> AxisProperty

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.

axDataCondition : BooleanOp -> ConditionalAxisProperty -> AxisProperty

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 ])
    ]

axStyle : List String -> AxisProperty

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.

axTranslate : Basics.Float -> AxisProperty

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.

Axis Domain

axDomain : Basics.Bool -> AxisProperty

Whether or not an axis baseline (domain) should be included as part of an axis. Used by pAxis.

axDomainDash : List Basics.Float -> AxisProperty

Dash style of axis baseline (domain). The parameter should list number of pixels in alternating dash and gap lengths. Used by pAxis.

axDomainDashOffset : Basics.Float -> AxisProperty

Number of pixels before the first axis baseline (domain) line dash is drawn. Used by pAxis.

axDomainCap : StrokeCap -> AxisProperty

How the ends of the axis baseline (domain) are capped. Used by pAxis.

axDomainColor : String -> AxisProperty

Color of axis domain line. Used by pAxis.

axDomainOpacity : Basics.Float -> AxisProperty

Opacity of axis domain line. Used by pAxis.

axDomainWidth : Basics.Float -> AxisProperty

Width of axis domain line. Used by pAxis.

Axis Labels

axFormat : String -> AxisProperty

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.

axTemporalFormats : List ( TimeUnit, String ) -> AxisProperty

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

axFormatAsNum : AxisProperty

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.

axFormatAsTemporal : AxisProperty

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.

axFormatAsCustom : String -> AxisProperty

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.

axLabels : Basics.Bool -> AxisProperty

Whether or not axis labels should be displayed. Used by pAxis.

axLabelAlign : HAlign -> AxisProperty

Horizontal alignment of axis tick labels. Used by pAxis.

cAxLabelAlign : HAlign -> HAlign -> ConditionalAxisProperty

Conditional axis label alignment. The first parameter provides the alignment when a predicate is true, the second when it is false. Used by axDataCondition.

axLabelAngle : Basics.Float -> AxisProperty

Rotation angle of axis labels (degrees from horizontal). Used by pAxis.

axLabelBaseline : VAlign -> AxisProperty

Vertical alignment of axis tick labels. Used by pAxis.

cAxLabelBaseline : VAlign -> VAlign -> ConditionalAxisProperty

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.

axLabelBound : Maybe Basics.Float -> AxisProperty

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.

axLabelBoundExpr : String -> AxisProperty

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.

axLabelColor : String -> AxisProperty

Color of axis tick label. Used by pAxis.

cAxLabelColor : String -> String -> ConditionalAxisProperty

Conditional axis label color. The first parameter provides the color when a predicate is true, the second when it is false. Used by axDataCondition.

axLabelExpr : String -> AxisProperty

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'))"
    ]

axLabelFlush : Maybe Basics.Float -> AxisProperty

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.

axLabelFlushOffset : Basics.Float -> AxisProperty

Number of pixels by which to offset flush-adjusted labels. Used by pAxis.

axLabelFont : String -> AxisProperty

Font name of an axis label. Used by pAxis.

cAxLabelFont : String -> String -> ConditionalAxisProperty

Conditional axis label font. The first parameter provides the font when a predicate is true, the second when it is false. Used by axDataCondition.

axLabelFontSize : Basics.Float -> AxisProperty

Font size of an axis label. Used by pAxis.

cAxLabelFontSize : Basics.Float -> Basics.Float -> ConditionalAxisProperty

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.

axLabelFontStyle : String -> AxisProperty

Font style of an axis label (e.g. "italic"). Used by pAxis.

cAxLabelFontStyle : String -> String -> ConditionalAxisProperty

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.

axLabelFontWeight : FontWeight -> AxisProperty

Font weight of an axis label. Used by pAxis.

cAxLabelFontWeight : FontWeight -> FontWeight -> ConditionalAxisProperty

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.

axLabelLimit : Basics.Float -> AxisProperty

Maximum length in pixels of axis tick labels. Used by pAxis.

axLabelLineHeight : Basics.Float -> AxisProperty

Axis label line height (useful for multi-line labels). Used by pAxis.

axLabelOffset : Basics.Float -> AxisProperty

Offset in pixels of an axis's labels relative to its ticks. Used by pAxis.

cAxLabelOffset : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis label offset. The first parameter provides the offset when a predicate is true, the second when it is false. Used by axDataCondition.

axLabelOpacity : Basics.Float -> AxisProperty

Opacity of an axis label. Used by pAxis.

cAxLabelOpacity : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis label opacity. The first parameter provides the opacity when a predicate is true, the second when it is false. Used by axDataCondition.

axLabelOverlap : OverlapStrategy -> AxisProperty

Overlap strategy for labels when they are too large to fit within the space devoted to an axis. Used by pAxis.

axLabelPadding : Basics.Float -> AxisProperty

Padding in pixels between an axis and its text labels. Used by pAxis.

cAxLabelPadding : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis label padding. The first parameter provides the padding when a predicate is true, the second when it is false. Used by axDataCondition.

axLabelSeparation : Basics.Float -> AxisProperty

The minimum separation between labels (in pixel units) before they are considered non-overlapping. Ignored if axLabelOverlap is osNone. Used by pAxis.

Axis Ticks

axTicks : Basics.Bool -> AxisProperty

Whether or not an axis should include tick marks. Used by pAxis.

axTickBand : TickBand -> AxisProperty

Where grid and ticks should be aligned with bands. Used by pAxis.

tbCenter : TickBand

Align to centre of tick band.

tbExtent : TickBand

Align to extent (edges) of tick band.

tbExpr : String -> TickBand

Specify a tick band alignment with an expression that should evaluate to "center" or "extent".

axTickCap : StrokeCap -> AxisProperty

How the ends of axis ticks are capped. Used by pAxis.

axTickColor : String -> AxisProperty

Color of axis ticks. Used by pAxis.

cAxTickColor : String -> String -> ConditionalAxisProperty

Conditional axis tick color. The first parameter provides the color when a predicate is true, the second when it is false. Used by axDataCondition.

axTickCount : ScaleNice -> AxisProperty

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.

axTickDash : List Basics.Float -> AxisProperty

Axis tick dash style. The parameter is a list of alternating 'on' and 'off' lengths in pixels representing the dashed line. Used by pAxis.

cAxTickDash : List Basics.Float -> List Basics.Float -> ConditionalAxisProperty

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.

axTickDashOffset : Basics.Float -> AxisProperty

Number of pixels before the first axis tick dash is drawn. Used by pAxis.

cAxTickDashOffset : Basics.Float -> Basics.Float -> ConditionalAxisProperty

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.

axTickExtra : Basics.Bool -> AxisProperty

Whether or not an extra axis tick should be added for the initial position of an axis. Used by pAxis.

axTickMinStep : Basics.Float -> AxisProperty

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.

axTickOffset : Basics.Float -> AxisProperty

Offset in pixels of an axis's ticks, labels and gridlines. Used by pAxis.

axTickOpacity : Basics.Float -> AxisProperty

Opacity of axis ticks. Used by pAxis.

cAxTickOpacity : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis tick opacity. The first parameter provides the opacity when a predicate is true, the second when it is false. Used by axDataCondition.

axTickRound : Basics.Bool -> AxisProperty

Whether or not axis tick positions should be rounded to nearest integer. Used by pAxis.

axTickSize : Basics.Float -> AxisProperty

Tick mark size in pixels. Used by pAxis.

cAxTickSize : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis tick size. The first parameter provides the size when a predicate is true, the second when it is false. Used by axDataCondition.

axTickWidth : Basics.Float -> AxisProperty

Width of axis ticks. Used by pAxis.

cAxTickWidth : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis tick width. The first parameter provides the width when a predicate is true, the second when it is false. Used by axDataCondition.

axValues : DataValues -> AxisProperty

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 ]
            ]
        )
    ]

Axis Title

axTitle : String -> AxisProperty

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.

axTitleAlign : HAlign -> AxisProperty

Horizontal alignment of an axis title. Used by pAxis.

axTitleAnchor : Anchor -> AxisProperty

Anchor position of an axis title. Used by pAxis.

axTitleAngle : Basics.Float -> AxisProperty

Angle of an axis title (degrees from horizontal). Used by pAxis.

axTitleBaseline : VAlign -> AxisProperty

Vertical alignment of axis title. Used by pAxis.

axTitleColor : String -> AxisProperty

Color of axis title. Used by pAxis.

axTitleFont : String -> AxisProperty

Font name for an axis title. Used by pAxis.

axTitleFontSize : Basics.Float -> AxisProperty

Font size of an axis title. Used by pAxis.

axTitleFontStyle : String -> AxisProperty

Font style of an axis title (e.g. "italic"). Used by pAxis.

axTitleFontWeight : FontWeight -> AxisProperty

Font weight of an axis title. Used by pAxis.

axTitleLimit : Basics.Float -> AxisProperty

Maximum length in pixels of axis title. Used by pAxis.

axTitleLineHeight : Basics.Float -> AxisProperty

Line height for multi-line axis titles. Used by pAxis.

axTitleOpacity : Basics.Float -> AxisProperty

Opacity of an axis title. Used by pAxis.

axTitlePadding : Basics.Float -> AxisProperty

Padding in pixels between a title and axis. Used by pAxis.

axTitleX : Basics.Float -> AxisProperty

X position of an axis title relative to the axis group. Used by pAxis.

axTitleY : Basics.Float -> AxisProperty

Y position of an axis title relative to the axis group. Used by pAxis.

Axis Grid

axGrid : Basics.Bool -> AxisProperty

Whether or not grid lines should be included as part of an axis. Used by pAxis.

axGridCap : StrokeCap -> AxisProperty

How the ends of gridlines are capped. Used by pAxis.

axGridColor : String -> AxisProperty

Color of grid lines associated with an axis. Used by pAxis.

cAxGridColor : String -> String -> ConditionalAxisProperty

Conditional axis grid color. The first parameter provides the color when a predicate is true, the second when it is false. Used by axDataCondition.

axGridDash : List Basics.Float -> AxisProperty

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.

cAxGridDash : List Basics.Float -> List Basics.Float -> ConditionalAxisProperty

Conditional axis grid dash. The first parameter provides the dash when a predicate is true, the second when it is false. Used by axDataCondition.

axGridDashOffset : Basics.Float -> AxisProperty

Default number of pixels before the first axis grid line dash is drawn. Used by pAxis.

cAxGridDashOffset : Basics.Float -> Basics.Float -> ConditionalAxisProperty

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.

axGridOpacity : Basics.Float -> AxisProperty

Opacity of grid lines associated with an axis. Used by pAxis.

cAxGridOpacity : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis grid opacity. The first parameter provides the opacity when a predicate is true, the second when it is false. Used by axDataCondition.

axGridWidth : Basics.Float -> AxisProperty

Width of grid lines associated with an axis. Used by pAxis.

cAxGridWidth : Basics.Float -> Basics.Float -> ConditionalAxisProperty

Conditional axis grid width. The first parameter provides the width when a predicate is true, the second when it is false. Used by axDataCondition.

5.1.4 Positioning Constants

Text Alignment

haLeft : HAlign

Left horizontal text alignment. Used by maAlign, axLabelAlign, cAxLabelAlign, axTitleAlign, leLabelAlign, leTitleAlign, hdLabelAlign, hdTitleAlign, axcoLabelAlign, axcoTitleAlign, lecoLabelAlign and lecoTitleAlign.

haCenter : HAlign

Center horizontal text alignment. Used by maAlign, axLabelAlign, cAxLabelAlign, axTitleAlign, leLabelAlign, leTitleAlign, hdLabelAlign, hdTitleAlign, axcoLabelAlign, axcoTitleAlign, lecoLabelAlign and lecoTitleAlign.

haRight : HAlign

Right horizontal text alignment. Used by maAlign, axLabelAlign, cAxLabelAlign, axTitleAlign, leLabelAlign, leTitleAlign, hdLabelAlign, hdTitleAlign, axcoLabelAlign, axcoTitleAlign, lecoLabelAlign and lecoTitleAlign.

haExpr : String -> HAlign

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

vaTop : VAlign

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.

vaLineTop : VAlign

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.

vaMiddle : VAlign

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.

vaBottom : VAlign

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.

vaLineBottom : VAlign

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.

vaAlphabetic : VAlign

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.

vaExpr : String -> VAlign

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.

Overlapping text

osNone : OverlapStrategy

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.

osGreedy : OverlapStrategy

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.

osParity : OverlapStrategy

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.

osExpr : String -> OverlapStrategy

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.

Relative Position

siTop : Side

Top side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.

siBottom : Side

Bottom side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.

siLeft : Side

Left side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.

siRight : Side

Right side, used, for example, to specify an axis position. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.

siExpr : String -> Side

Specify a side position with an interactive expression. Used by axOrient, hdLabelOrient, hdTitleOrient, hdOrient, tiOrient and ticoOrient.

5.2 Mark Channels

Appearance of the visual marks in the visualization such as their color or size.

size : List MarkChannel -> List LabelledSpec -> List LabelledSpec

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 ]

angle : List MarkChannel -> List LabelledSpec -> List LabelledSpec

Encode an angle (orientation) channel. This allows data-driven rotation of text, point-based marks.

color : List MarkChannel -> List LabelledSpec -> List LabelledSpec

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 ]

fill : List MarkChannel -> List LabelledSpec -> List LabelledSpec

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.

stroke : List MarkChannel -> List LabelledSpec -> List LabelledSpec

Encode a stroke channel. This acts in a similar way to encoding by color but only affects the exterior boundary of marks.

strokeDash : List MarkChannel -> List LabelledSpec -> List LabelledSpec

Encode a stroke dash channel.

enc =
    encoding
        << position X [ pName "date", pTemporal ]
        << position Y [ pName "price", pQuant ]
        << strokeDash [ mName "company" ]

strokeWidth : List MarkChannel -> List LabelledSpec -> List LabelledSpec

Encode a stroke width channel.

opacity : List MarkChannel -> List LabelledSpec -> List LabelledSpec

Encode an opacity channel.

fillOpacity : List MarkChannel -> List LabelledSpec -> List LabelledSpec

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.

strokeOpacity : List MarkChannel -> List LabelledSpec -> List LabelledSpec

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.

shape : List MarkChannel -> List LabelledSpec -> List LabelledSpec

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 ]

5.2.1 Mark Channel Properties

mName : String -> MarkChannel

Name of field used for encoding with a mark property channel. Used by functions that influence mark channels such as size and color.

mDatum : DataValue -> MarkChannel

Name of a literal data item used for encoding with a mark property channel. Unlike mNum, mStr and mBoo, datum literals represent values in data space. Used by functions that influence mark channels such as size and color.

mRepeat : Arrangement -> MarkChannel

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.

mRepeatDatum : Arrangement -> MarkChannel

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.

mNominal : MarkChannel

Indicate a data field encoded as a mark property is nominal. This is the default data type.

mOrdinal : MarkChannel

Indicate a data field encoded as a mark property is ordinal.

mQuant : MarkChannel

Indicate a data field encoded as a mark property is quantitative.

mTemporal : MarkChannel

Indicate a data field encoded as a mark property is temporal.

mGeo : MarkChannel

Indicate a data field encoded as a mark property is a geo feature.

mScale : List ScaleProperty -> MarkChannel

Scaling applied to a field when encoding with a mark property channel. The scale will transform a field's value into a color, shape, size etc. Used by functions that influence mark channels such as size and color.

mBin : List BinProperty -> MarkChannel

Discretize numeric values into bins when encoding with a mark property channel. Used by functions that influence mark channels such as size and color.

mBinned : MarkChannel

Indicate that data encoding with a mark are already binned.

mBand : Basics.Float -> MarkChannel

Apply offset relative to band width for a mark property. Value should be in the range [0, 1] as a proportion of the band width. Used by functions that influence mark channels such as size and color.

mSort : List SortProperty -> MarkChannel

Sort order when encoding sortable mark properties such as colour. Used by functions that influence mark channels such as size and color.

mTimeUnit : TimeUnit -> MarkChannel

Time unit aggregation of field values when encoding with a mark property channel. Used by functions that influence mark channels such as size and color.

mTitle : String -> MarkChannel

Title of a field when encoding with a mark property channel. For multi-line titles, insert \n at each line break or use a """ multi-line string. Used by functions that influence mark channels such as size and color.

mAggregate : Operation -> MarkChannel

Compute some aggregate summary statistics for a field to be encoded with a mark property channel. The type of aggregation is determined by the given operation parameter. Used by functions that influence mark channels such as size and color.

mLegend : List LegendProperty -> MarkChannel

Properties of a legend that describes a mark's encoding. For no legend, provide an empty list as the parameter. Used by functions that influence mark channels such as size and color.

mPath : String -> MarkChannel

SVG path string used when encoding with a mark property channel. Useful for providing custom shapes.

mNum : Basics.Float -> MarkChannel

Literal numeric value when encoding with a mark property channel. Used by functions that influence mark channels such as size and color.

mStr : String -> MarkChannel

Literal string value when encoding with a mark property channel. Used by functions that influence mark channels such as size and color.

mBoo : Basics.Bool -> MarkChannel

Boolean value when encoding with a mark property channel. Used by functions that influence mark channels such as size and color.

mSymbol : Symbol -> MarkChannel

A symbol literal when encoding with a mark property channel. Can be useful when making a symbol dependent on some data or selection condition. Used by functions that influence mark channels such as size and color.

5.2.2 Mark Legends

See the Vega-Lite legend property documentation.

leNumExpr : String -> (number -> LegendProperty) -> LegendProperty

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 ]
            ]

lecoNumExpr : String -> (number -> LegendConfig) -> LegendConfig

Used by coLegend to provide an expression to a legend configuration function requiring a numeric value.

leNumsExpr : String -> (List number -> LegendProperty) -> LegendProperty

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 ]
            ]

lecoNumsExpr : String -> (List number -> LegendConfig) -> LegendConfig

Used by coLegend to provide an expression to a legend property configuration requiring a list of numbers (for dash styles).

leStrExpr : String -> (String -> LegendProperty) -> LegendProperty

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 ]
            ]

lecoStrExpr : String -> (String -> LegendConfig) -> LegendConfig

Used by coLegend to provide an expression to an legend configuration function requiring a string value.

leAria : List Aria -> LegendProperty

ARIA properties for providing accessible SVG output associated with an mLegend. If an empty list is provided, ARIA tagging will be switched off.

leGradient : Legend

Used by leType to specify a gradient legend for continuous quantitative data.

leSymbol : Legend

Used by leType to specify a symbol legend for categorical data.

leClipHeight : Basics.Float -> LegendProperty

Limit height of mLegend entries.

leColumnPadding : Basics.Float -> LegendProperty

Horizontal padding between symbol mLegend entries.

leColumns : Basics.Float -> LegendProperty

Number of columns in which to arrange symbol mLegend entries.

leCornerRadius : Basics.Float -> LegendProperty

mLegend corner radius.

leDirection : MarkOrientation -> LegendProperty

Direction of an mLegend.

leFillColor : String -> LegendProperty

mLegend background color.

leFormat : String -> LegendProperty

Formatting pattern for mLegend values. To distinguish between formatting as numeric values and data/time values, additionally use leFormatAsNum, leFormatAsTemporal or leFormatAsCustom.

leFormatAsNum : LegendProperty

Indicate that mLegend labels should be formatted as numbers. To control the precise numeric format, additionally use leFormat providing a d3 numeric format string.

leFormatAsTemporal : LegendProperty

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.

leFormatAsCustom : String -> LegendProperty

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.

leGradientLength : Basics.Float -> LegendProperty

Length in pixels of the primary axis of a color ramp mLegend.

lecoGradientHorizontalMaxLength : Basics.Float -> LegendConfig

Used by coLegend to specify the default maximum length in pixels of a horizontal color ramp legend.

lecoGradientHorizontalMinLength : Basics.Float -> LegendConfig

Used by coLegend to specify the default minimum length in pixels of a horizontal color ramp legend.

lecoGradientVerticalMaxLength : Basics.Float -> LegendConfig

Used by coLegend to specify the default maximum length in pixels of a vertical color ramp legend.

lecoGradientVerticalMinLength : Basics.Float -> LegendConfig

Used by coLegend to specify the default minimum length in pixels of a vertical color ramp legend.

leGradientOpacity : Basics.Float -> LegendProperty

Opacity of a color ramp mLegend.

leGradientThickness : Basics.Float -> LegendProperty

Thickness in pixels of a color ramp mLegend.

leGradientStrokeColor : String -> LegendProperty

Color for strokes in a color ramp mLegend.

leGradientStrokeWidth : Basics.Float -> LegendProperty

Width for strokes in a color ramp mLegend.

leGridAlign : CompositionAlignment -> LegendProperty

Alignment to apply to a symbol mLegend rows and columns.

leLabelAlign : HAlign -> LegendProperty

Horizontal alignment of mLegend labels.

leLabelBaseline : VAlign -> LegendProperty

Vertical alignment of mLegend labels.

leLabelColor : String -> LegendProperty

Color for mLegend labels.

leLabelExpr : String -> LegendProperty

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]" ]

leLabelFont : String -> LegendProperty

Font for mLegend labels.

leLabelFontSize : Basics.Float -> LegendProperty

Font size mLegend labels.

leLabelFontStyle : String -> LegendProperty

Font style (e.g italic) for mLegend labels.

leLabelFontWeight : FontWeight -> LegendProperty

Font weight for mLegend labels.

leLabelLimit : Basics.Float -> LegendProperty

Maximum width for mLegend labels in pixel units.

leLabelOffset : Basics.Float -> LegendProperty

Offset for mLegend labels.

leLabelOverlap : OverlapStrategy -> LegendProperty

Strategy for resolving overlapping mLegend labels.

leOffset : Basics.Float -> LegendProperty

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.

leOrient : LegendOrientation -> LegendProperty

Position of a mLegend in a scene.

lePadding : Basics.Float -> LegendProperty

Padding in pixels between an mLegend and axis.

leRowPadding : Basics.Float -> LegendProperty

Vertical spacing in pixel units between a symbol mLegend entries.

leStrokeColor : String -> LegendProperty

mLegend border color.

leStrokeWidth : Basics.Float -> LegendProperty

mLegend border stroke width.

leSymbolDash : List Basics.Float -> LegendProperty

Symbol dash style in an mLegend.

leSymbolDashOffset : Basics.Float -> LegendProperty

Symbol dash offset in an mLegend.

leSymbolFillColor : String -> LegendProperty

mLegend symbol fill color.

leSymbolLimit : Basics.Int -> LegendProperty

Maximum number of symbols in an mLegend.

leSymbolOffset : Basics.Float -> LegendProperty

Symbol offset between mLegend symbols and legend area.

leSymbolOpacity : Basics.Float -> LegendProperty

mLegend symbol opacity.

leSymbolSize : Basics.Float -> LegendProperty

mLegend symbol size.

leSymbolStrokeColor : String -> LegendProperty

mLegend symbol outline color.

leSymbolStrokeWidth : Basics.Float -> LegendProperty

mLegend symbol stroke width.

leSymbolType : Symbol -> LegendProperty

mLegend symbol type.

leTickCount : Basics.Float -> LegendProperty

Number of tick marks in a quantitative mLegend.

leTitle : String -> LegendProperty

Title of an mLegend. For multi-line titles, insert \n at each line break or use a """ multi-line string.

leTitleAlign : HAlign -> LegendProperty

Horizontal alignment for mLegend titles.

leTitleAnchor : Anchor -> LegendProperty

Horizontal alignment for mLegend titles.

leTitleBaseline : VAlign -> LegendProperty

Vertical alignment for mLegend titles.

leTitleColor : String -> LegendProperty

Color for mLegend title.

leTitleFont : String -> LegendProperty

Font for mLegend titles.

leTitleFontSize : Basics.Float -> LegendProperty

Font size for mLegend titles.

leTitleFontStyle : String -> LegendProperty

Font style (italic etc.) for mLegend titles.

leTitleFontWeight : FontWeight -> LegendProperty

Font weight for mLegend titles.

leTitleLimit : Basics.Float -> LegendProperty

Maximum size in pixel units for mLegend titles.

leTitleLineHeight : Basics.Float -> LegendProperty

Height in pixels for each line of a multi-line mLegend title.

leTitleOpacity : Basics.Float -> LegendProperty

Opacity of an mLegend title.

leTitleOrient : LegendOrientation -> LegendProperty

Position of an mLegend title relative to the main legend content.

leTitlePadding : Basics.Float -> LegendProperty

Spacing in pixel units between title and mLegend.

leType : Legend -> LegendProperty

Type of mLegend.

leValues : DataValues -> LegendProperty

An explicit set of mLegend values.

leX : Basics.Float -> LegendProperty

x-position of an mLegend group in pixel units for absolute positioning when leOrient is set to loNone.

leY : Basics.Float -> LegendProperty

y-position of an mLegend group in pixel units for absolute positioning when leOrient is set to loNone.

leZIndex : Basics.Int -> LegendProperty

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.

Legend Constants

loLeft : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend to the left of the visualization it describes.

loRight : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend outside and to the right of the visualization it describes.

loTop : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend outside and above the visualization it describes.

loBottom : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend outside and below the visualization it describes.

loTopLeft : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the top-left corner.

loTopRight : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the top-right corner.

loBottomLeft : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the bottom-left corner.

loBottomRight : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to position legend within the visualization it describes in the bottom-right corner.

loNone : LegendOrientation

Used by leOrient, leTitleOrient and lecoOrient to prevent automatic legend positioning (allows legend to be located explicitly via x y coordinates).

5.3 Text Channel

Relate to the appearance of the text and tooltip elements of the visualization. See the Vega-Lite text documentation

text : List TextChannel -> List LabelledSpec -> List LabelledSpec

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 ]

tooltip : List TextChannel -> List LabelledSpec -> List LabelledSpec

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.

tooltips : List (List TextChannel) -> List LabelledSpec -> List LabelledSpec

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" ] ]

tName : String -> TextChannel

Name of field used for encoding with a text channel. Used by text, tooltip and tCondition.

tRepeat : Arrangement -> TextChannel

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.

tNominal : TextChannel

Indicate a data field encoded as a text property is nominal. This is the default data type. Used by text, tooltip and tCondition.

tOrdinal : TextChannel

Indicate a data field encoded as a text property is ordinal. Used by text, tooltip and tCondition.

tQuant : TextChannel

Indicate a data field encoded as a text property is quantitative. Used by text, tooltip and tCondition.

tTemporal : TextChannel

Indicate a data field encoded as a text property is temporal. Used by text, tooltip and tCondition.

tGeo : TextChannel

Indicate a data field encoded as a text property is a geo feature. Used by text, tooltip and tCondition.

tBin : List BinProperty -> TextChannel

Discretize numeric values into bins when encoding with a text channel. Used by text, tooltip and tCondition.

tBinned : TextChannel

Indicate that data encoded with a text channel are already binned. Used by text, tooltip and tCondition.

tAggregate : Operation -> TextChannel

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.

tTimeUnit : TimeUnit -> TextChannel

Time unit aggregation of field values when encoding with a text channel. Used by text, tooltip and tCondition.

tTitle : String -> TextChannel

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.

tStr : String -> TextChannel

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" ]

tDatum : DataValue -> TextChannel

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.

tFormat : String -> TextChannel

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.

tFormatAsNum : TextChannel

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.

tFormatAsTemporal : TextChannel

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.

tFormatAsCustom : String -> TextChannel

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.


type FontWeight

Generated by fwBold, fwBolder, fwLighter, fwNormal, fwValue and fwExpr.

fwBold : FontWeight

Specify a bold font weight.

fwBolder : FontWeight

Specify a bolder font weight.

fwLighter : FontWeight

Specify a lighter font weight.

fwNormal : FontWeight

Specify a normal font weight.

fwValue : Basics.Int -> FontWeight

Specify a numeric font weight that should be between 100 (lightest) and 900 (boldest).

fwExpr : String -> FontWeight

Expression that evaluates to some font weight such as "bold", "lighter" or "600".

5.4 Hyperlink Channel

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

hyperlink : List HyperlinkChannel -> List LabelledSpec -> List LabelledSpec

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" ]

hName : String -> HyperlinkChannel

Name of field used for encoding with a hyperlink channel. Used by hyperlink and url.

hRepeat : Arrangement -> HyperlinkChannel

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.

hNominal : HyperlinkChannel

Indicate a data field encoded as a hyperlink or url property is nominal. This is the default data type. Used by hyperlink and url.

hOrdinal : HyperlinkChannel

Indicate a data field encoded as a hyperlink property is ordinal. Used by hyperlink and url.

hQuant : HyperlinkChannel

Indicate a data field encoded as a hyperlink or url property is quantitative. Used by hyperlink and url.

hTemporal : HyperlinkChannel

Indicate a data field encoded as a hyperlink or url property is temporal.

hGeo : HyperlinkChannel

Indicate a data field encoded as a hyperlink property is a geo feature. Used by hyperlink and url.

hBin : List BinProperty -> HyperlinkChannel

Discretize numeric values into bins when encoding with a hyperlink channel. Used by hyperlink and url.

hBinned : HyperlinkChannel

Indicate that data encoded with a hyperlink channel are already binned. Used by hyperlink and url.

hAggregate : Operation -> HyperlinkChannel

Compute some aggregate summary statistics for a field to be encoded with a hyperlink channel. The type of aggregation is determined by the given operation parameter. Used by hyperlink and url.

hTimeUnit : TimeUnit -> HyperlinkChannel

Time unit aggregation of field values when encoding with a hyperlink channel. Used by hyperlink and url.

hStr : String -> HyperlinkChannel

Literal string value when encoding with a hyperlink channel. Used by hyperlink and url.

5.5 URL Channel

Data-driven URL used for image specification. A data field can contain URL strings defining the location of image files that can be shown with the image mark.

url : List HyperlinkChannel -> List LabelledSpec -> List LabelledSpec

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" ]

5.6 Order Channel

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.

order : List OrderChannel -> List LabelledSpec -> List LabelledSpec

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 ] ]

oName : String -> OrderChannel

Name of field used for encoding with an order channel.

oRepeat : Arrangement -> OrderChannel

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.

oNominal : OrderChannel

Indicate a data field encoded with an order channel is nominal. Used by order and oCondition.

oOrdinal : OrderChannel

Indicate a data field encoded with an order channel is ordinal. Used by order and oCondition.

oQuant : OrderChannel

Indicate a data field encoded with an order channel is quantitative. Used by order and oCondition.

oTemporal : OrderChannel

Indicate a data field encoded with an order channel is temporal. Used by order and oCondition.

oGeo : OrderChannel

Indicate a data field encoded with an order channel is a geo feature. Used by order and oCondition.

oBin : List BinProperty -> OrderChannel

Discretize numeric values into bins when encoding with an order channel. Used by order and oCondition.

oAggregate : Operation -> OrderChannel

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.

oSort : List SortProperty -> OrderChannel

Sort order to be used by an order channel. Used by order and oCondition.

oTimeUnit : TimeUnit -> OrderChannel

Time unit aggregation of field values when encoding with an order channel. Used by order and oCondition.

oNum : Basics.Float -> OrderChannel

Specify a literal numeric value for an order channel. Useful for setting a conditional z-order with interaction to bring selected feature to 'front'.

5.7 Facet Channels

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.

row : List FacetChannel -> List LabelledSpec -> List LabelledSpec

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 [] ]

column : List FacetChannel -> List LabelledSpec -> List LabelledSpec

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 [] ]

5.8 Level of Detail Channel

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.

detail : List DetailChannel -> List LabelledSpec -> List LabelledSpec

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 ]

dName : String -> DetailChannel

Name of field used for encoding with a level of detail (grouping) channel.

dNominal : DetailChannel

Indicate a data field encoded with a detail channel is nominal. This is the default data type.

dOrdinal : DetailChannel

Indicate a data field encoded with a detail channel is ordinal.

dQuant : DetailChannel

Indicate a data field encoded with a detail channel is quantitative.

dTemporal : DetailChannel

Indicate a data field encoded with a detail channel is temporal.

dGeo : DetailChannel

Indicate a data field encoded with a detail channel is a geo feature.

dAggregate : Operation -> DetailChannel

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.

dBin : List BinProperty -> DetailChannel

Discretize numeric values into bins when encoding with a level of detail (grouping) channel.

dTimeUnit : TimeUnit -> DetailChannel

Form of time unit aggregation of field values when encoding with a level of detail (grouping) channel.

5.9 Key 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.

key : List KeyChannel -> List LabelledSpec -> List LabelledSpec

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

kName : String -> KeyChannel

Name of field used for encoding with a key channel.

kNominal : KeyChannel

Indicate a data field encoded as a key channel property is nominal. This is the default data type.

kOrdinal : KeyChannel

Indicate a data field encoded as a key channel property is ordinal.

kQuant : KeyChannel

Indicate a data field encoded as a key channel property is quantitative.

kTemporal : KeyChannel

Indicate a data field encoded as a key channel property is temporal.

kGeo : KeyChannel

Indicate a data field encoded as a key channel property stores geo-features.

5.10 Scaling

Used to specify how the encoding of a data field should be applied. See the Vega-Lite scale documentation.

scType : Scale -> ScaleProperty

Type of scaling to apply. Used by pScale and mScale.

scNumExpr : String -> (number -> ScaleProperty) -> ScaleProperty

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 ] ]

scBooExpr : String -> (Basics.Bool -> ScaleProperty) -> ScaleProperty

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 ] ]

5.10.1 Scale Domain

Describes the data values that will be encoded.

doNumExpr : String -> (number -> ScaleDomain) -> ScaleDomain

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) ]
            ]

scDomain : ScaleDomain -> ScaleProperty

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 ]) ]
    ]

scDomainExpr : String -> ScaleProperty

Expression that defines a scaling domain. Used by pScale and mScale.

categoricalDomainMap : List ( String, String ) -> List ScaleProperty

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
    ]

domainRangeMap : ( Basics.Float, String ) -> ( Basics.Float, String ) -> List ScaleProperty

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

doNums : List Basics.Float -> ScaleDomain

Numeric values that define a scDomain.

doMin : Basics.Float -> ScaleDomain

Set the minimum value of a continuous numeric domain. The maximum will be determined by the data. To set both the min and max values use doNums. Used by scDomain.

doMid : Basics.Float -> ScaleDomain

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.

doMax : Basics.Float -> ScaleDomain

Set the maximum value of a continuous numeric domain. The minimum will be determined by the data. To set both the min and max values use doNums. Used by scDomain.

doStrs : List String -> ScaleDomain

String values that define a scDomain.

doDts : List (List DateTime) -> ScaleDomain

Date-time values that define a scDomain.

doDtsExpr : String -> ScaleDomain

Expression that should evaluate to a list of date-times that define a scDomain.

doMinDt : List DateTime -> ScaleDomain

Set the minimum value of a date-time domain. The maximum will be determined by the data. To set both the min and max values use doDts. Used by scDomain.

doMinDtExpr : String -> ScaleDomain

Set the minimum value of a date-time domain with an expression that evaluates to a date-time. Used by scDomain.

doMaxDt : List DateTime -> ScaleDomain

Set the maximum value of a date-time domain. The minimum will be determined by the data. To set both the min and max values use doDts. Used by scDomain.

doMaxDtExpr : String -> ScaleDomain

Set the maximum value of a date-time domain with an expression that evaluates to a date-time. Used by scDomain.

fromPosixTime : Time.Posix -> List DateTime

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 ]
            ]

doUnaggregated : ScaleDomain

Indicate that a domain of aggregated data should be scaled to the domain of the data prior to aggregation. Used by scDomain.

doUnionWith : ScaleDomain -> ScaleDomain

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 ])) ]

doSelection : String -> ScaleDomain

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.

doSelectionChannel : String -> Channel -> ScaleDomain

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.

doSelectionField : String -> String -> ScaleDomain

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.

5.10.2 Scale Range

Describes the values after data have been encoded (e.g. pixel positions or color values).

raNumExpr : String -> (number -> ScaleRange) -> ScaleRange

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) ]
            ]

scRange : ScaleRange -> ScaleProperty

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 ]) ]
    ]

raExprs : List String -> ScaleRange

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

raName : String -> ScaleRange

Name of a pre-defined scale range (e.g. symbol or diverging). Used by scRange.

raNums : List Basics.Float -> ScaleRange

Numeric scale range. Depending on the scaling this may be a [min, max] pair, or a list of explicit numerical values. Used by scRange.

raMin : Basics.Float -> ScaleRange

Set the minimum value of a continuous numeric range. To set both the min and max values use raNums. Used by scRange.

raMax : Basics.Float -> ScaleRange

Set the maximum value of a continuous numeric range. To set both the min and max values use raNums. Used by scRange.

raNumLists : List (List Basics.Float) -> ScaleRange

Scale range comprising numeric lists. Useful, for example, when defining custom dash styles for a strokeDash channel encoding. Used by scRange.

raStrs : List String -> ScaleRange

Text scale range for discrete scales. Used by scRange.

raField : String -> ScaleRange

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.

5.10.3 Scaling Properties

scScheme : String -> List Basics.Float -> ScaleProperty

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 ] ]
    ]

scSchemeExpr : String -> List Basics.Float -> ScaleProperty

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" [] ] ]

scAlign : Basics.Float -> ScaleProperty

Alignment of the steps within the scale range. Parameter is capped between 0 and 1 where 0.5 indicates steps are centred within range, 0 shifts bands to an axis, 1 away from axis. Used by pScale and mScale.

scPadding : Basics.Float -> ScaleProperty

Padding in pixels to apply to a scaling. Used by pScale and mScale.

scPaddingInner : Basics.Float -> ScaleProperty

Inner padding to apply to a band scaling. Used by pScale and mScale.

scPaddingOuter : Basics.Float -> ScaleProperty

Outer padding to apply to a band scaling. Used by pScale and mScale.

scReverse : Basics.Bool -> ScaleProperty

Whether or not to reverse sorting order of a scaling. Used by pScale and mScale.

scRound : Basics.Bool -> ScaleProperty

Whether or not numeric values in a scaling are rounded to integers. Used by pScale and mScale.

scClamp : Basics.Bool -> ScaleProperty

Whether or not values outside the data domain are clamped to the minimum or maximum value. Used by pScale and mScale.

scInterpolate : CInterpolate -> ScaleProperty

Interpolation method for scaling range values. Used by pScale and mScale.

scNice : ScaleNice -> ScaleProperty

'Nice' minimum and maximum values in a scaling (e.g. multiples of 10). Used by pScale and mScale.

scZero : Basics.Bool -> ScaleProperty

Whether or not a numeric scaling should be forced to include a zero value. Used by pScale and mScale.

scBand : Scale

A band scale. Used when specifying a scType.

scBinOrdinal : Scale

An ordinal band scale. Used when specifying a scType.

scLinear : Scale

A linear scale. Used when specifying a scType.

scLog : Scale

A log scale used when specifying a scType. Defaults to log of base 10, but can be customised by setting scBase to some other value. If data to be scaled contain zeros or negative values, consider scSymLog instead.

scSymLog : Scale

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.

scConstant : Basics.Float -> ScaleProperty

The desired desired slope of the scSymLog function at zero. If unspecified, the default is 1. Used by pScale and mScale.

scBase : Basics.Float -> ScaleProperty

The base to use for log scaling. Used by pScale and mScale.

scOrdinal : Scale

An ordinal scale. Used when specifying a scType.

scPoint : Scale

A point scale. Used when specifying a scType.

scPow : Scale

A power scale used when specifying a scType. The exponent to use for scaling is specified with scExponent.

scExponent : Basics.Float -> ScaleProperty

The exponent to use for power scaling. Used by pScale and mScale.

scQuantile : Scale

A quantile scale. Used when specifying a scType.

scQuantize : Scale

A quantizing scale. Used when specifying a scType.

scSqrt : Scale

A square root scale. Used when specifying a scType.

scThreshold : Scale

A threshold scale. Used when specifying a scType.

scTime : Scale

A temporal scale. Used when specifying a scType.

scUtc : Scale

A UTC temporal scale. Used when specifying a scType.

Scaling Constants

niTrue : ScaleNice

Enable nice scaling. Used by scNice and axTickCount.

niFalse : ScaleNice

Disable nice scaling. Used by scNice and axTickCount.

niMillisecond : ScaleNice

Nice time intervals that try to align with rounded milliseconds. Used by scNice and axTickCount.

niSecond : ScaleNice

Nice time intervals that try to align with whole or rounded seconds. Used by scNice and axTickCount.

niMinute : ScaleNice

Nice time intervals that try to align with whole or rounded minutes. Used by scNice and axTickCount.

niHour : ScaleNice

Nice time intervals that try to align with whole or rounded hours. Used by scNice and axTickCount.

niDay : ScaleNice

Nice time intervals that try to align with whole or rounded days. Used by scNice and axTickCount.

niWeek : ScaleNice

Nice time intervals that try to align with whole or rounded weeks. Used by scNice and axTickCount.

niMonth : ScaleNice

Nice time intervals that try to align with whole or rounded months. Used by scNice and axTickCount.

niYear : ScaleNice

Nice time intervals that try to align with whole or rounded years. Used by scNice and axTickCount.

niTickCount : Basics.Int -> ScaleNice

Desired number of tick marks in a 'nice' scaling. Used by scNice and axTickCount.

niInterval : TimeUnit -> Basics.Int -> ScaleNice

'Nice' temporal interval values when scaling. Used by scNice and axTickCount.

niExpr : String -> ScaleNice

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.

5.10.4 Color Scaling

For color interpolation types, see the Vega-Lite continuous scale documentation.

cubeHelix : Basics.Float -> CInterpolate

Cube helix color interpolation for continuous color scales using the given gamma value (anchored at 1). Used by scInterpolate.

cubeHelixLong : Basics.Float -> CInterpolate

Long-path cube helix color interpolation for continuous color scales using the given gamma value (anchored at 1). Used by scInterpolate.

hcl : CInterpolate

HCL color interpolation for continuous color scales.

hclLong : CInterpolate

HCL color interpolation in polar coordinate space for continuous color scales.

hsl : CInterpolate

HSL color interpolation for continuous color scales.

hslLong : CInterpolate

HSL color interpolation in polar coordinate space for continuous color scales.

lab : CInterpolate

Lab color interpolation for continuous color scales.

rgb : Basics.Float -> CInterpolate

RGB color interpolation for continuous color scales using the given gamma value (anchored at 1). Used by scInterpolate.

6. View Composition

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

layer : List Spec -> ( VLProperty, Spec )

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 [] ]
        ]
    ]

concat : List Spec -> ( VLProperty, Spec )

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 [] ]
        ]
    ]

columns : Basics.Int -> ( VLProperty, Spec )

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.

hConcat : List Spec -> ( VLProperty, Spec )

Specifications to be juxtaposed horizontally in a column layout of views.

vConcat : List Spec -> ( VLProperty, Spec )

Juxtapose some specifications vertically in a row layout of views.

align : CompositionAlignment -> ( VLProperty, Spec )

Alignment to apply to grid rows and columns generated by a composition operator. This version sets the same alignment for rows and columns.

alignRC : CompositionAlignment -> CompositionAlignment -> ( VLProperty, Spec )

Similar to align but with independent alignments for rows (first parameter) and columns (second parameter).

caAll : CompositionAlignment

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.

caEach : CompositionAlignment

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.

caNone : CompositionAlignment

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 : Bounds -> ( VLProperty, Spec )

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.

boFull : Bounds

Bounds calculation should use the entire plot area (including axes, title, and legend).

boFlush : Bounds

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 : Basics.Float -> ( VLProperty, Spec )

Spacing between sub-views in a composition operator. For example,

toVegaLite
    [ data []
    , spacing 40
    , specification mySpec
    , facet [ rowBy [ fName "row" ], columnBy [ fName "col" ] ]
    ]

spacingRC : Basics.Float -> Basics.Float -> ( VLProperty, Spec )

Similar to spacing but with independent spacing for rows (first parameter) and columns (second parameter).

center : Basics.Bool -> ( VLProperty, Spec )

Whether or not sub-views specified in a composition operator should be centred relative to their respective rows and columns.

centerRC : Basics.Bool -> Basics.Bool -> ( VLProperty, Spec )

Similar to center but with independent centring for rows and columns.

6.1 Resolution

Controlling the (in)dependence between composed views. See the Vega-Lite resolve documentation.

resolve : List LabelledSpec -> ( VLProperty, Spec )

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 ] ]

resolution : Resolve -> List LabelledSpec -> List LabelledSpec

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 ) ])

reShared : Resolution

When specifying a resolution, indicates a channel should be shared with others in a composite visualization.

reIndependent : Resolution

When specifying a resolution, indicates that a channel should be independent of others in a composite visualization.

reAxis : List ( Channel, Resolution ) -> Resolve

Indicate how a channel's axes should be resolved when defined in more than one view in a composite visualization.

reLegend : List ( Channel, Resolution ) -> Resolve

Indicate how a channel's legends should be resolved when defined in more than one view in a composite visualization.

reScale : List ( Channel, Resolution ) -> Resolve

Indicate how a channel's scales should be resolved when defined in more than one view in a composite visualization.

chX : Channel

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.

chY : Channel

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.

chX2 : Channel

Reference to whatever is being encoded on the X2 channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.

chY2 : Channel

Reference to whatever is being encoded on the Y2 channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.

chXOffset : Channel

Reference to whatever is being encoded on the XOffset channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.

chYOffset : Channel

Reference to whatever is being encoded on the Y offset channel. Can be used in a resolution specification. Used by soByChannel, doSelectionChannel and seEncodings.

chColor : Channel

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.

chOpacity : Channel

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.

chShape : Channel

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.

chSize : Channel

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.

chStrokeDash : Channel

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.

6.2 Faceted Views

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

repeatFlow : List String -> ( VLProperty, Spec )

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
    ]

repeat : List RepeatFields -> ( VLProperty, 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
    ]

rowFields : List String -> RepeatFields

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.

columnFields : List String -> RepeatFields

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.

layerFields : List String -> RepeatFields

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.

facetFlow : List FacetChannel -> ( VLProperty, Spec )

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 : List FacetMapping -> ( VLProperty, 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
    ]

columnBy : List FacetChannel -> FacetMapping

The mapping between a column and its field definitions in a set of faceted small multiples. This is used when specifying a more flexible facet rather than the compact, but simplified, column. Used by facet.

rowBy : List FacetChannel -> FacetMapping

The mapping between a row and its field definitions in a set of faceted small multiples. This is used when specifying a more flexible facet rather than the compact, but simplified, row. Used by facet.

fName : String -> FacetChannel

Name of field used for encoding with a facet channel. Used by row, column, rowBy, columnBy and facetFlow.

fNominal : FacetChannel

Indicate a data field encoded as a facet property is nominal. This is the default data type. Used by row, column, rowBy, columnBy and facetFlow.

fOrdinal : FacetChannel

Indicate a data field encoded as a facet property is ordinal. Used by row, column, rowBy, columnBy and facetFlow.

fQuant : FacetChannel

Indicate a data field encoded as a facet property is quantitative. Used by row, column, rowBy, columnBy and facetFlow.

fTemporal : FacetChannel

Indicate a data field encoded as a facet property is temporal. Used by row, column, rowBy, columnBy and facetFlow.

fGeo : FacetChannel

Indicate a data field encoded as a facet property is a geo feature. Used by row, column, rowBy, columnBy and facetFlow.

fAggregate : Operation -> FacetChannel

Compute some aggregate summary statistics for a field to be encoded with a facet channel. The type of aggregation is determined by the given operation parameter. Used by row, column, rowBy, columnBy and facetFlow.

fBin : List BinProperty -> FacetChannel

Discretize numeric values into bins when encoding with a facet channel. Used by row, column, rowBy, columnBy and facetFlow.

fSort : List SortProperty -> FacetChannel

Sort order for a field when encoding with a faceted channel. Used by row, column, rowBy, columnBy and facetFlow.

For example,

row
    [ fName "site"
    , fOrdinal
    , fSort [ soByField "x" opMedian, soDescending ]
    ]

fHeader : List HeaderProperty -> FacetChannel

Guide that spans a collection of faceted plots, each of which may have their own axes. Used by row, column, rowBy, columnBy and facetFlow.

fTimeUnit : TimeUnit -> FacetChannel

Form of time unit aggregation of field values when encoding with a facet channel. Used by row, column, rowBy, columnBy and facetFlow.

fAlign : CompositionAlignment -> FacetChannel

Alignment to apply to a rows or columns in a facet's sub-plot. Used by row, column, rowBy, columnBy and facetFlow.

fCenter : Basics.Bool -> FacetChannel

Whether or not a facet's sub-plots should be centred relative to their respective rows or columns. Used by row, column, rowBy, columnBy and facetFlow.

fSpacing : Basics.Float -> FacetChannel

Spacing in pixels between sub-views in a faceted view. Used by row, column, rowBy, columnBy and facetFlow.

asSpec : List ( VLProperty, Spec ) -> 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.

specification : Spec -> ( VLProperty, Spec )

Define a specification object for use with faceted and repeated small multiples.

spec = ...
toVegaLite
    [ facet [ rowBy [ fName "Origin", fNominal ] ]
    , specification spec
    ]

arLayer : Arrangement

Layer arrangement in a repeated view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.

arFlow : Arrangement

Flow arrangement in a repeated/faceted view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.

arColumn : Arrangement

Column arrangement in a repeated/faceted view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.

arRow : Arrangement

Row arrangement in a repeated/faceted view. Used by pRepeat, pRepeatDatum, mRepeat, mRepeatDatum, tRepeat, hRepeat, oRepeat and soByRepeat.

6.2.1 Facet Headers

See Vega-Lite header documentation

hdNumExpr : String -> (number -> HeaderProperty) -> HeaderProperty

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 ]
            ]

hdStrExpr : String -> (String -> HeaderProperty) -> HeaderProperty

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 ]
            ]

Header Labels

hdLabelAngle : Basics.Float -> HeaderProperty

Header label rotation angle (in degrees from horizontal) for a faceted view. A 'label' is the title for each sub-plot in a faceted view. Used by fHeader and coHeader.

hdLabelAlign : HAlign -> HeaderProperty

Horizontal alignment of header labels. A 'label' is the title for each sub-plot in a faceted view. Used by fHeader and coHeader.

hdLabelAnchor : Anchor -> HeaderProperty

Anchor position of header labels. A 'label' is the title for each sub-plot in a faceted view. Used by fHeader and coHeader.

hdLabelBaseline : VAlign -> HeaderProperty

Vertical alignment of header labels. Used by fHeader and coHeader.

hdLabelColor : String -> HeaderProperty

Header label text color for a faceted view. Used by fHeader and coHeader.

hdLabelExpr : String -> HeaderProperty

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.

hdLabelFont : String -> HeaderProperty

Header label font in a faceted view. Used by fHeader and coHeader.

hdLabelFontSize : Basics.Float -> HeaderProperty

Header label font size in a faceted view. Used by fHeader and coHeader.

hdLabelFontStyle : String -> HeaderProperty

Header label font style (e.g. italic) in a faceted view. Used by fHeader and coHeader.

hdLabelFontWeight : FontWeight -> HeaderProperty

Header label font weight in a faceted view. Used by fHeader and coHeader.

hdLabelLimit : Basics.Float -> HeaderProperty

Maximum length of a header label in a faceted view. Used by fHeader and coHeader.

hdLabelLineHeight : Basics.Float -> HeaderProperty

Header label line height in a faceted view (useful for multi-line labels). Used by fHeader and coHeader.

hdLabelOrient : Side -> HeaderProperty

The position of a header label relative to a sub-plot. A 'label' is the title for each sub-plot in a faceted view. Used by fHeader and coHeader.

hdLabelPadding : Basics.Float -> HeaderProperty

Spacing in pixels between facet labels and the main plot area. Used by fHeader and coHeader.

hdLabels : Basics.Bool -> HeaderProperty

Whether or not labels in a faceted view are displayed. Used by fHeader and coHeader.

Header Title

hdTitle : String -> HeaderProperty

Header title in a faceted view. A 'title' is the overall title describing the collection of faceted plots. For multi-line titles, insert \n at each line break or use a """ multi-line string. Used by fHeader and coHeader.

hdTitleAlign : HAlign -> HeaderProperty

Horizontal alignment of header title in a faceted view. Used by fHeader and coHeader.

hdTitleAnchor : Anchor -> HeaderProperty

Anchor position of a header title in a faceted view. Used by fHeader and coHeader.

hdTitleAngle : Basics.Float -> HeaderProperty

Text angle of a header title in a faceted view (degrees from horizontal). Used by fHeader and coHeader.

hdTitleBaseline : VAlign -> HeaderProperty

Vertical alignment of a header title in a faceted view. Used by fHeader and coHeader.

hdTitleColor : String -> HeaderProperty

Text color of a header title in a faceted view. Used by fHeader and coHeader.

hdTitleFont : String -> HeaderProperty

Title font in a faceted view. Used by fHeader and coHeader.

hdTitleFontStyle : String -> HeaderProperty

Header title font style (e.g. italic) in a faceted view. Used by fHeader and coHeader.

hdTitleFontSize : Basics.Float -> HeaderProperty

Title font size in a faceted view. Used by fHeader and coHeader.

hdTitleFontWeight : FontWeight -> HeaderProperty

Title font weight in a faceted view. Used by fHeader and coHeader.

hdTitleLimit : Basics.Float -> HeaderProperty

Maximum length of a header title in a faceted view. Used by fHeader and coHeader.

hdTitleLineHeight : Basics.Float -> HeaderProperty

Header title line height in a faceted view (useful for multi-line titles). Used by fHeader and coHeader.

hdTitleOrient : Side -> HeaderProperty

The position of a header title relative to a group of sub-plots in a faceted view. Used by fHeader and coHeader.

hdOrient : Side -> HeaderProperty

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.

hdTitlePadding : Basics.Float -> HeaderProperty

Spacing in pixels between the main facet title and labels. Used by fHeader and coHeader.

Header Formatting

hdFormat : String -> HeaderProperty

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.

hdFormatAsNum : HeaderProperty

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.

hdFormatAsTemporal : HeaderProperty

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.

hdFormatAsCustom : String -> HeaderProperty

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.

7. Parameters

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.

params : List LabelledSpec -> ( VLProperty, Spec )

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 ]
    ]

param : String -> List ParamProperty -> List LabelledSpec -> List LabelledSpec

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 [] ]

paValue : DataValue -> ParamProperty

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

paValues : DataValues -> ParamProperty

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 ] )
                ]
            ]

paExpr : String -> ParamProperty

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" ]

7.1 Selection Parameters

paSelect : Selection -> List SelectionProperty -> ParamProperty

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 ] ] ]

sePoint : Selection

Specify a point selection type. Used by paSelect.

seInterval : Selection

Indicate a draggable bounding rectangle can be made for selecting all items that intersect with it. Used by paSelect.

seClear : String -> SelectionProperty

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.

seEncodings : List Channel -> SelectionProperty

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 ] ] ]

seFields : List String -> SelectionProperty

Field names for projecting a selection over multiple fields. Used by paSelect.

seNearest : Basics.Bool -> SelectionProperty

Whether or not a selection should capture nearest marks to a pointer rather than an exact position match. Used by paSelect.

seOn : String -> SelectionProperty

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" ] ]

seToggle : TogglePredicate -> SelectionProperty

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 ] ]

tpFalse : TogglePredicate

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.

tpExpr : String -> TogglePredicate

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

tpShiftKey : TogglePredicate

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.

tpAltKey : TogglePredicate

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.

tpCtrlKey : TogglePredicate

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.

seTranslate : String -> SelectionProperty

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.

seZoom : String -> SelectionProperty

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.

Selection Bindings

paBind : PBinding -> ParamProperty

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

paBindings : List ( String, PBinding ) -> ParamProperty

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 ] )
        ]
    ]

paBindScales : ParamProperty

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 ]

paBindLegend : String -> ParamProperty

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]"

Input Elements

ipRange : List InputProperty -> PBinding

Range slider input element that can bound to a named parameter. Used by paBind.

ipCheckbox : List InputProperty -> PBinding

Checkbox input element that can bound to a named parameter. Used by paBind.

ipRadio : List InputProperty -> PBinding

Radio box input element that can bound to a named parameter. Used by paBind.

ipSelect : List InputProperty -> PBinding

Select input element that can bound to a named parameter. Used by paBind.

ipText : List InputProperty -> PBinding

Text input element that can bound to a named parameter. Used by paBind.

ipNumber : List InputProperty -> PBinding

Number input element that can bound to a named parameter. Used by paBind.

ipDate : List InputProperty -> PBinding

Date input element that can bound to a named parameter. Used by paBind.

ipTime : List InputProperty -> PBinding

Time input element that can bound to a named parameter. Used by paBind.

ipMonth : List InputProperty -> PBinding

Month input element that can bound to a named parameter. Used by paBind.

ipWeek : List InputProperty -> PBinding

Week input element that can bound to a named parameter. Used by paBind.

ipDateTimeLocal : List InputProperty -> PBinding

Local time input element that can bound to a named parameter. Used by paBind.

ipTel : List InputProperty -> PBinding

Telephone number input element that can bound to a named parameter. Used by paBind.

ipColor : List InputProperty -> PBinding

Color input element that can bound to a named parameter. Used by paBind.

inDebounce : Basics.Float -> InputProperty

Delay to introduce when processing input events in order to avoid unnecessary event broadcasting. Used by input elements such as ipRange and ipCheckbox.

inElement : String -> InputProperty

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.

inOptions : List String -> InputProperty

Options for a ipRadio or ipSelect input element. Assumes all options are strings. For other types, consider inDatumOptions or inDataOptions.

inLabelledOptions : List ( String, String ) -> InputProperty

Labelled options for an ipRadio or ipSelect input element. Like inOptions but used where the text of the input label option differs from the name of option itself. Options and their corresponding labels should be paired as tuples with the first element being the option and the second its label. For example,

ipRadio
    [ inLabelledOptions
        [ ( "Anti-social behaviour", "ASB" )
        , ( "Criminal damage and arson", "Damage" )
        , ( "Drugs", "Drugs" )
        , ( "Robbery", "Robbery" )
        , ( "Vehicle crime", "Vehicle" )
        ]
    ]

inDatumOptions : List DataValue -> InputProperty

Options for a ipRadio or ipSelect input element. Unlike inOptions, this allows for mixed data types to be listed. For example, to create a list of numbers and boolean values:

ipRadio [ inDatumOptions [ num 2, num 3, boo False, boo True ] ]

inLabelledDatumOptions : List ( DataValue, String ) -> InputProperty

Labelled options for an ipRadio or ipSelect input element. Like inDatumOptions except that each option has a label that can differ from its value. Options and their corresponding labels should be paired as tuples. For example,

ps =
    params
        << param "Background"
            [ paValue (str "white")
            , paBind
                (ipRadio
                    [ inLabelledDatumOptions
                        [ ( str "white", "Light" )
                        , ( str "rgb(255,250,245)", "Muted" )
                        , ( str "rgb(40,0,0)", "Dark" )
                        ]
                    ]
                )
            ]

inDataOptions : List DataValues -> InputProperty

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 ] ] ]

inLabelledDataOptions : List ( DataValues, String ) -> InputProperty

Labelled options for an ipRadio or ipSelect input element. Like inDataOptions except that each option has a label that can differ from its value. Options and their corresponding labels should be paired as tuples. For example, to label different line styles:

ps =
    params
        << param "Style"
            [ paValues (nums [ 0 ])
            , paBind
                (ipSelect
                    [ inLabelledDataOptions
                        [ ( nums [ 0 ], "Solid" )
                        , ( nums [ 2, 2 ], "Dotted" )
                        , ( nums [ 8, 8 ], "Dashed" )
                        ]
                    ]
                )
            ]

mk =
    line [ maNumsExpr "Style" maStrokeDash ]

inMin : Basics.Float -> InputProperty

Minimum slider value for a ipRange input element.

inMax : Basics.Float -> InputProperty

Maximum slider value for a ipRange input element.

inName : String -> InputProperty

Custom label for a ipRadio or ipSelect input element.

inStep : Basics.Float -> InputProperty

Smallest ipRange slider increment.

inPlaceholder : String -> InputProperty

Initial place-holding text for input elements such as ipText fields.

seSelectionMark : List SelectionMarkProperty -> SelectionProperty

Appearance of an interval selection mark (dragged rectangle). Used by paSelect.

smFill : String -> SelectionMarkProperty

Fill color of an interval selection mark (dragged rectangular area). Used by seSelectionMark.

smFillOpacity : Basics.Float -> SelectionMarkProperty

Fill opacity of an interval selection mark in the range 0 to 1. Used by seSelectionMark.

smStroke : String -> SelectionMarkProperty

Stroke color of an interval selection mark. Used by seSelectionMark.

smStrokeDash : List Basics.Float -> SelectionMarkProperty

Stroke dash style of an interval selection mark. Used by seSelectionMark.

smStrokeDashOffset : Basics.Float -> SelectionMarkProperty

Stroke dash offset of an interval selection mark. Used by seSelectionMark.

smStrokeOpacity : Basics.Float -> SelectionMarkProperty

Stroke opacity of an interval selection mark in the range 0 to 1. Used by seSelectionMark.

smStrokeWidth : Basics.Float -> SelectionMarkProperty

Stroke width of an interval selection mark. Used by seSelectionMark.

smCursor : Cursor -> SelectionMarkProperty

Cursor type to appear when pointer is over an interval selection mark (dragged rectangular area). Used by seSelectionMark.

7.2 Selection Resolution

Determines how selections are made across multiple views. See the Vega-lite resolve selection documentation.

seResolve : SelectionResolution -> SelectionProperty

Strategy that determines how selections’ data queries are resolved when applied in a filter transform, conditional encoding rule, or scale domain. Used by paSelect.

seGlobal : SelectionResolution

One selection available across all subviews (default). Used by seResolve.

seUnion : SelectionResolution

Each subview contains its own brush and marks are selected if they lie within any of these individual selections. Used by seResolve.

seIntersection : SelectionResolution

Each subview contains its own brush and marks are selected if they lie within all of these individual selections. Used by seResolve.

7.3 Conditional Channel Encodings

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.

mCondition : Predicate -> List MarkChannel -> List MarkChannel -> MarkChannel

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" ]
        ]

mConditions : List ( Predicate, List MarkChannel ) -> List MarkChannel -> MarkChannel

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" ]
        ]

oCondition : Predicate -> List OrderChannel -> List OrderChannel -> OrderChannel

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 ] ]

oConditions : List ( Predicate, List OrderChannel ) -> List OrderChannel -> OrderChannel

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 ]
    ]

tCondition : Predicate -> List TextChannel -> List TextChannel -> TextChannel

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.

tConditions : List ( Predicate, List TextChannel ) -> List TextChannel -> TextChannel

Make an text 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 text, tooltip.

hCondition : Predicate -> List HyperlinkChannel -> List HyperlinkChannel -> HyperlinkChannel

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.

prParam : String -> Predicate

Parameter name that should evaluate to either true or false for use in functions that use predicates, such as mCondition, oCondition and tCondition.

prParamEmpty : String -> Predicate

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.

prTest : BooleanOp -> Predicate

Test that should evaluate to either true or false for use in functions that use predicates, such as mCondition, oCondition and tCondition.

bParam : String -> BooleanOp

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" ]
    ]

expr : String -> BooleanOp

Expression that should evaluate to either true or false. Can use any valid Vega expression. Used by prTest, fiCompose, axDataCondition, and, or and not.

and : BooleanOp -> BooleanOp -> BooleanOp

Apply an 'and' Boolean operation as part of a logical composition.

and (expr "datum.IMDB_Rating === null") (expr "datum.Rotten_Tomatoes_Rating === null")

or : BooleanOp -> BooleanOp -> BooleanOp

Apply an 'or' Boolean operation as part of a logical composition.

not : BooleanOp -> BooleanOp

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

8. Top-Level Settings

These are in addition to the data and transform options described above. See the Vega-Lite top-level spec documentation

name : String -> ( VLProperty, Spec )

Name to be associated with a visualization.

description : String -> ( VLProperty, Spec )

Description to be associated with a visualization.

height : Basics.Float -> ( VLProperty, Spec )

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.

heightOfContainer : ( VLProperty, Spec )

Set the height of the view to be that of the surrounding container. Allows responsive sizing to be specified.

width : Basics.Float -> ( VLProperty, Spec )

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.

widthOfContainer : ( VLProperty, Spec )

Set the width of the view to be that of the surrounding container. Allows responsive sizing to be specified.

widthStep : Basics.Float -> ( VLProperty, Spec )

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 [] ]

widthStepOffset : Basics.Float -> ( VLProperty, Spec )

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

heightStep : Basics.Float -> ( VLProperty, Spec )

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 [] ]

heightStepOffset : Basics.Float -> ( VLProperty, Spec )

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 : Padding -> ( VLProperty, Spec )

Padding around the visualization in pixel units. The way padding is interpreted will depend on the autosize properties.

paSize : Basics.Float -> Padding

Indicate uniform padding around a visualization in pixel units. Used by padding and coPadding.

paNumExpr : String -> (number -> Padding) -> Padding

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

paEdges : Basics.Float -> Basics.Float -> Basics.Float -> Basics.Float -> Padding

Padding around a visualization in pixel units. The four parameters refer to left, top, right, and bottom edges respectively. Used by padding and coPadding.

paEdgesExpr : String -> String -> String -> String -> Padding

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.

autosize : List Autosize -> ( VLProperty, Spec )

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 []
    ]

asContent : Autosize

Interpret visualization dimensions to be for the data rectangle (external padding added to this size). Used by autosize and coAutosize.

asFit : Autosize

Interpret visualization dimensions to be for the entire visualization (data rectangle is shrunk to accommodate external decorations padding). Used by autosize and coAutosize.

asFitX : Autosize

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.

asFitY : Autosize

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.

asNone : Autosize

No autosizing to be applied. Used by autosize and coAutosize.

asPad : Autosize

Automatically expand size of visualization from the given dimensions in order to fit in all supplementary decorations (legends etc.). Used by autosize and coAutosize.

asPadding : Autosize

Interpret visualization width to be for the entire visualization (data rectangle is shrunk to accommodate external padding). Used by autosize and coAutosize.

asResize : Autosize

Recalculate autosizing on every view update. Used by autosize and coAutosize.

background : String -> ( VLProperty, Spec )

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.

backgroundExpr : String -> ( VLProperty, Spec )

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" ]

userMeta : List ( String, DataValue ) -> ( VLProperty, Spec )

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 )
    ]

8.1 Title

Per-title settings. To standardize the appearance of all titles in a multi-view specification, use coTitle instead.

tiNumExpr : String -> (number -> TitleProperty) -> TitleProperty

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 ]

ticoNumExpr : String -> (number -> TitleConfig) -> TitleConfig

Provide an expression to a title configuration function requiring a numeric value. Used by coTitle.

tiStrExpr : String -> (String -> TitleProperty) -> TitleProperty

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 ]

ticoStrExpr : String -> (String -> TitleConfig) -> TitleConfig

Provide an expression to a title configuration function requiring a string value. Used by coTitle.

title : String -> List TitleProperty -> ( VLProperty, Spec )

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""" []

titleExpr : String -> List TitleProperty -> ( VLProperty, Spec )

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" [] ]

tiAnchor : Anchor -> TitleProperty

Anchor position when placing a title.

tiAngle : Basics.Float -> TitleProperty

Angle of title text (degrees from horizontal).

tiBaseline : VAlign -> TitleProperty

Vertical alignment of a title.

tiColor : String -> TitleProperty

Text colour of a title.

tiDx : Basics.Float -> TitleProperty

Delta offset of title and subtitle x-position.

tiDy : Basics.Float -> TitleProperty

Delta offset of title and subtitle y-position.

tiFont : String -> TitleProperty

title font.

tiFontSize : Basics.Float -> TitleProperty

title font size.

tiFontStyle : String -> TitleProperty

title font style (italic etc.).

tiFontWeight : FontWeight -> TitleProperty

title font weight.

tiLineHeight : Basics.Float -> TitleProperty

Line height (vertical spacing) for title text.

tiSubtitle : String -> TitleProperty

Subtitle text, placed beneath the primary title. For multi-line subtitles, insert \n at each line break or use a """ multi-line string. Used by title and titleExpr.

tiSubtitleColor : String -> TitleProperty

Color of a subtitle. Used by title and titleExpr.

tiSubtitleFont : String -> TitleProperty

Font name of a subtitle. Used by title and titleExpr.

tiSubtitleFontSize : Basics.Float -> TitleProperty

Font size of a subtitle. Used by title and titleExpr.

tiSubtitleFontStyle : String -> TitleProperty

Font style of a subtitle such as "normal" or "italic". Used by title and titleExpr.

tiSubtitleFontWeight : FontWeight -> TitleProperty

Font weight of a subtitle. Used by title and titleExpr.

tiSubtitleLineHeight : Basics.Float -> TitleProperty

Line height in pixels of each line of text in a multi-line subtitle. Used by title and titleExpr.

tiSubtitlePadding : Basics.Float -> TitleProperty

Padding in pixels between title and subtitle text. Used by title and titleExpr.

tiFrame : TitleFrame -> TitleProperty

title position anchor. Can be relative to the full bounding box (tfBounds) or the group in which the titled visualization belongs (tfGroup).

tfBounds : TitleFrame

Specify a title anchor position relative to the full bounding box. Used by tiFrame and ticoFrame.

tfGroup : TitleFrame

Specify a title anchor position relative to the group width / height. Used by tiFrame and ticoFrame.

tfExpr : String -> TitleFrame

Specify a title anchor position as an expression that should evaluate to one of "bounds" or "frame". Used by tiFrame and ticoFrame.

tiLimit : Basics.Float -> TitleProperty

Maximum length of the title display in pixel units.

tiOffset : Basics.Float -> TitleProperty

Offset in pixel units of the title relative to the chart body.

tiOrient : Side -> TitleProperty

Placement of title relative to the chart body.

tiStyle : List String -> TitleProperty

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.

tiZIndex : Basics.Int -> TitleProperty

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.

8.2 View Background

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

viewBackground : List ViewBackground -> ( VLProperty, Spec )

The background style of a single view or layer in a view composition.

vbNumExpr : String -> (number -> ViewBackground) -> ViewBackground

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 ]

vicoNumExpr : String -> (number -> ViewConfig) -> ViewConfig

Provide an expression to a view background confguration function requiring a numeric value. Used by coView.

vbNumsExpr : String -> (List number -> ViewBackground) -> ViewBackground

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"
            [ paValues (nums [ 2, 2 ])
            , paBind (ipSelect [ inDataOptions [ nums [ 2, 2 ], nums [ 8, 8 ] ] ])
            ]

bg =
    viewBackground [ vbNumsExpr "dashStyle" viewStrokeDash ]

Used by viewBackground and vicoBackground.

vicoNumsExpr : String -> (List number -> ViewConfig) -> ViewConfig

Provide an expression to a view background configuration function requiring a list of numbers (for dash styles). Used by coView.

vbStrExpr : String -> (Maybe String -> ViewBackground) -> ViewBackground

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.

vicoStrExpr : String -> (Maybe String -> ViewConfig) -> ViewConfig

Provide an expression to a view background configuration function requiring a Maybe String value. Used by coView.

vicoBooExpr : String -> (Basics.Bool -> ViewConfig) -> ViewConfig

Provide an expression to a view configuration function a Boolean value. Used by coView.

viewStyle : List String -> ViewBackground

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.

viewCornerRadius : Basics.Float -> ViewBackground

The radius in pixels of rounded corners in single view or layer background. Used by viewBackground and vicoBackground.

viewFill : Maybe String -> ViewBackground

Fill color for a single view or layer background. Used by viewBackground and vicoBackground.

viewFillOpacity : Basics.Float -> ViewBackground

Fill opacity for a single view or layer background. Used by viewBackground and vicoBackground.

viewOpacity : Basics.Float -> ViewBackground

Overall opacity for a single view or layer background. Used by viewBackground and vicoBackground.

viewStroke : Maybe String -> ViewBackground

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.

viewStrokeCap : StrokeCap -> ViewBackground

Stroke cap line-ending around a single view or layer background. Used by viewBackground and vicoBackground.

viewStrokeDash : List Basics.Float -> ViewBackground

Stroke dash style for a line around a single view or layer background. Used by viewBackground and vicoBackground.

viewStrokeDashOffset : Basics.Float -> ViewBackground

Stroke dash offset for line around a single view or layer background. Used by viewBackground and vicoBackground.

viewStrokeJoin : StrokeJoin -> ViewBackground

Stroke line-joining style around a single view or layer background. Used by viewBackground and vicoBackground.

viewStrokeMiterLimit : Basics.Float -> ViewBackground

Stroke mitre limit at which to bevel a line join around a single view or layer background. Used by viewBackground and vicoBackground.

viewStrokeOpacity : Basics.Float -> ViewBackground

Stroke opacity around a single view or layer background. Used by viewBackground and vicoBackground.

viewStrokeWidth : Basics.Float -> ViewBackground

Stroke around a single view or layer background. Used by viewBackground and vicoBackground.

8.3 Configuration of Default Appearance

Allows default properties for most marks and guides to be set. See the Vega-Lite configuration documentation.

configure : List LabelledSpec -> ( VLProperty, Spec )

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 [] ]

configuration : ConfigurationProperty -> List LabelledSpec -> List LabelledSpec

A configuration option to be applied globally across the visualization.

coBooExpr : String -> (Basics.Bool -> ConfigurationProperty) -> ConfigurationProperty

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.

coStrExpr : String -> (String -> ConfigurationProperty) -> ConfigurationProperty

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.

coArea : List MarkProperty -> ConfigurationProperty

Configure the default appearance of area marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coAria : Basics.Bool -> ConfigurationProperty

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.

coAutosize : List Autosize -> ConfigurationProperty

Configure the default sizing of visualizations. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxis : List AxisConfig -> ConfigurationProperty

Configure the default appearance of axes. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisXFilter : ConfigurationProperty -> ConfigurationProperty

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)

coAxisYFilter : ConfigurationProperty -> ConfigurationProperty

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)

coAxisLeft : List AxisConfig -> ConfigurationProperty

Configure the default appearance of left-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisRight : List AxisConfig -> ConfigurationProperty

Configure the default appearance of right-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisTop : List AxisConfig -> ConfigurationProperty

Configure the default appearance of top-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisBottom : List AxisConfig -> ConfigurationProperty

Configure the default appearance of bottom-side axes. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisBand : List AxisConfig -> ConfigurationProperty

Configure the default appearance of any axes using a band (binned) scale. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisDiscrete : List AxisConfig -> ConfigurationProperty

Configure the default appearance of any axes using a discrete scale. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisPoint : List AxisConfig -> ConfigurationProperty

Configure the default appearance of any axes using a point scale. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisQuant : List AxisConfig -> ConfigurationProperty

Configure the default appearance of any quantitative axes. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisTemporal : List AxisConfig -> ConfigurationProperty

Configure the default appearance of any temporal axes. Used by configuration, coAxisXFilter and coAxisYFilter.

coAxisStyles : List ( String, List AxisProperty ) -> ConfigurationProperty

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.

coBackground : String -> ConfigurationProperty

Configure the default background color of visualizations. Used by configuration, coAxisXFilter and coAxisYFilter.

coBar : List MarkProperty -> ConfigurationProperty

Configure the default appearance of bar marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coCircle : List MarkProperty -> ConfigurationProperty

Configure the default appearance of circle marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coConcat : List ConcatConfig -> ConfigurationProperty

Configure the default appearance of concatenated layouts. Used by configuration, coAxisXFilter and coAxisYFilter.

coCountTitle : String -> ConfigurationProperty

Configure the default title style for count fields. Used by configuration, coAxisXFilter and coAxisYFilter.

coCustomFormatTypes : Basics.Bool -> ConfigurationProperty

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"
    ]

See how to register a Vega-Lite custom formatter.

coFieldTitle : FieldTitleProperty -> ConfigurationProperty

Configure the default title generation style for fields. Used by configuration, coAxisXFilter and coAxisYFilter.

coFont : String -> ConfigurationProperty

Configure the default font for all titles, labels and text marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coGeoshape : List MarkProperty -> ConfigurationProperty

Configure the default appearance of geoshape marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coFacet : List FacetConfig -> ConfigurationProperty

Configure the default appearance of facet layouts. Used by configuration, coAxisXFilter and coAxisYFilter.

coHeader : List HeaderProperty -> ConfigurationProperty

Configure the default appearance of facet headers. Used by configuration, coAxisXFilter and coAxisYFilter.

coLegend : List LegendConfig -> ConfigurationProperty

Configure the default appearance of legends. Used by configuration, coAxisXFilter and coAxisYFilter.

coLine : List MarkProperty -> ConfigurationProperty

Configure the default appearance of line marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coLocale : List LocaleProperty -> ConfigurationProperty

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}€"
                ]
            )

coMark : List MarkProperty -> ConfigurationProperty

Configure the default mark appearance. Used by configuration, coAxisXFilter and coAxisYFilter.

coMarkStyles : List ( String, List MarkProperty ) -> ConfigurationProperty

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.

coNumberFormat : String -> ConfigurationProperty

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

coNumberFormatType : String -> ConfigurationProperty

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.

coNormalizedNumberFormat : String -> ConfigurationProperty

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.

coNormalizedNumberFormatType : String -> ConfigurationProperty

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.

coTooltipFormat : List ConfigurationProperty -> ConfigurationProperty

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

coPadding : Padding -> ConfigurationProperty

Configure the default padding in pixels from the edge of the of visualization to the data rectangle. Used by configuration, coAxisXFilter and coAxisYFilter.

coPoint : List MarkProperty -> ConfigurationProperty

Configure the default appearance of point marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coProjection : List ProjectionProperty -> ConfigurationProperty

Configure the default style of map projections. Used by configuration, coAxisXFilter and coAxisYFilter.

coRange : List RangeConfig -> ConfigurationProperty

Configure the default range properties used when scaling. Used by configuration, coAxisXFilter and coAxisYFilter.

coRect : List MarkProperty -> ConfigurationProperty

Configure the default appearance of rectangle marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coRule : List MarkProperty -> ConfigurationProperty

Configure the default appearance of rule marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coScale : List ScaleConfig -> ConfigurationProperty

Configure the default scale properties used when scaling. Used by configuration, coAxisXFilter and coAxisYFilter.

coSelection : List ( Selection, List SelectionProperty ) -> ConfigurationProperty

Configure the default appearance of selection marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coSquare : List MarkProperty -> ConfigurationProperty

Configure the default appearance of square marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coText : List MarkProperty -> ConfigurationProperty

Configure the default appearance of text marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coTick : List MarkProperty -> ConfigurationProperty

Configure the default appearance of tick marks. Used by configuration, coAxisXFilter and coAxisYFilter.

coTitle : List TitleConfig -> ConfigurationProperty

Configure the default style of visualization titles. Used by configuration, coAxisXFilter and coAxisYFilter.

coTimeFormat : String -> ConfigurationProperty

Configure the default time format for axis and legend labels. Used by configuration, coAxisXFilter and coAxisYFilter.

coTimeFormatType : String -> ConfigurationProperty

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.

coTrail : List MarkProperty -> List LabelledSpec -> List LabelledSpec

Configure the default style of trail marks.

coView : List ViewConfig -> ConfigurationProperty

Configure the default single view style. Used by configuration, coAxisXFilter and coAxisYFilter.

8.3.1 Axis Configuration

See the Vega-Lite axis config documentation.

axcoAria : List Aria -> AxisConfig

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.

axcoBandPosition : Basics.Float -> AxisConfig

Default axis band position. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoDisable : Basics.Bool -> AxisConfig

Whether or not axes are generated for positional encoding by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoDomain : Basics.Bool -> AxisConfig

Whether or not an axis domain should be displayed by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoDomainDash : List Basics.Float -> AxisConfig

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.

axcoDomainDashOffset : Basics.Float -> AxisConfig

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.

axcoDomainCap : StrokeCap -> AxisConfig

Default appearance of ends of axis domain. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoDomainColor : String -> AxisConfig

Default axis domain color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoDomainOpacity : Basics.Float -> AxisConfig

Default axis domain opacity. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoDomainWidth : Basics.Float -> AxisConfig

Default axis domain width style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoMaxExtent : Basics.Float -> AxisConfig

Default maximum extent style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoMinExtent : Basics.Float -> AxisConfig

Default minimum extent style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTranslate : Basics.Float -> AxisConfig

Default coordinate space translation offset for axis layout. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoGrid : Basics.Bool -> AxisConfig

Whether or not an axis grid is displayed by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoGridCap : StrokeCap -> AxisConfig

Default appearance of ends of grid lines. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoGridColor : String -> AxisConfig

Default axis grid color style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoGridDash : List Basics.Float -> AxisConfig

Default axis line dash style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoGridDashOffset : Basics.Float -> AxisConfig

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.

axcoGridOpacity : Basics.Float -> AxisConfig

Default axis grid line opacity. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoGridWidth : Basics.Float -> AxisConfig

Default axis grid line width. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabels : Basics.Bool -> AxisConfig

Whether or not an axis has labels by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelAlign : HAlign -> AxisConfig

Default axis label horizontal alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelAngle : Basics.Float -> AxisConfig

Default axis label angle (degrees from horizontal). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelBaseline : VAlign -> AxisConfig

Default axis label vertical alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelBound : Maybe Basics.Float -> AxisConfig

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.

axcoLabelBoundExpr : String -> AxisConfig

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.

axcoLabelColor : String -> AxisConfig

Default axis label color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelExpr : String -> AxisConfig

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.

axcoLabelFlush : Maybe Basics.Float -> AxisConfig

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.

axcoLabelFlushOffset : Basics.Float -> AxisConfig

Default number of pixels by which to offset flush-adjusted labels. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelFont : String -> AxisConfig

Default axis label font. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelFontSize : Basics.Float -> AxisConfig

Default axis label font size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelFontStyle : String -> AxisConfig

Default axis label font style (e.g. "italic"). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelFontWeight : FontWeight -> AxisConfig

Default axis label font weight. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelLimit : Basics.Float -> AxisConfig

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.

axcoLabelLineHeight : Basics.Float -> AxisConfig

Default axis label line height (useful for multi-line labels). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelOffset : Basics.Float -> AxisConfig

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.

axcoLabelOpacity : Basics.Float -> AxisConfig

Default axis label opacity. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelOverlap : OverlapStrategy -> AxisConfig

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.

axcoLabelPadding : Basics.Float -> AxisConfig

Default axis label padding (space between labels in pixels). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoLabelSeparation : Basics.Float -> AxisConfig

Default axis label separation (minimum spacing between axis labels). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoOffset : Basics.Float -> AxisConfig

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.

axcoStyle : List String -> AxisConfig

A list of named styles to apply as defaults to axes. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTicks : Basics.Bool -> AxisConfig

Whether or not an axis should show ticks by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickBand : TickBand -> AxisConfig

Default alignment of grid lines and ticks in band scales. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickCap : StrokeCap -> AxisConfig

Default axis tick end cap style. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickColor : String -> AxisConfig

Default axis tick mark color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickCount : ScaleNice -> AxisConfig

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.

axcoTickDash : List Basics.Float -> AxisConfig

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.

axcoTickDashOffset : Basics.Float -> AxisConfig

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.

axcoTickExtra : Basics.Bool -> AxisConfig

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.

axcoTickOffset : Basics.Float -> AxisConfig

Default offset in pixels of axis ticks, labels and gridlines. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickOpacity : Basics.Float -> AxisConfig

Default opacity of axis ticks. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickRound : Basics.Bool -> AxisConfig

Whether or not axis tick labels use rounded values by default. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickSize : Basics.Float -> AxisConfig

Default axis tick mark size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTickMinStep : Basics.Float -> AxisConfig

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.

axcoTickWidth : Basics.Float -> AxisConfig

Default axis tick mark width. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleAlign : HAlign -> AxisConfig

Default axis tick label horizontal alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleAnchor : Anchor -> AxisConfig

Default anchor position of axis titles. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleAngle : Basics.Float -> AxisConfig

Default axis title angle (degrees from horizontal). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleBaseline : VAlign -> AxisConfig

Default axis title vertical alignment. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleColor : String -> AxisConfig

Default axis title color. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleFont : String -> AxisConfig

Default axis title font. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleFontSize : Basics.Float -> AxisConfig

Default axis title font size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleFontStyle : String -> AxisConfig

Default axis title font style (e.g. "italic"). Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleFontWeight : FontWeight -> AxisConfig

Default axis title font weight. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleLimit : Basics.Float -> AxisConfig

Default axis title maximum size. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleLineHeight : Basics.Float -> AxisConfig

Default line height for multi-line axis titles. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleOpacity : Basics.Float -> AxisConfig

Default opacity of axis titles. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitlePadding : Basics.Float -> AxisConfig

Default axis title padding between axis line and text. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleX : Basics.Float -> AxisConfig

Default axis x-position relative to the axis group. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

axcoTitleY : Basics.Float -> AxisConfig

Default axis y-position relative to the axis group. Used by coAxis, coAxisLeft, coAxisRight, coAxisTop, coAxisBottom, coAxisBand, coAxisDiscrete, coAxisPoint, coAxisQuant and coAxisTemporal.

8.3.2 Legend Configuration

See the Vega-Lite legend configuration documentation.

lecoAria : List Aria -> LegendConfig

Used by coLegend to specify the default ARIA properties for providing accessible SVG output associated with a legend. If an empty list is provided, ARIA tagging will be switched off.

lecoClipHeight : Basics.Float -> LegendConfig

Used by coLegend to specify the default maximum height of legend entries.

lecoColumnPadding : Basics.Float -> LegendConfig

Used by coLegend to specify the default horizontal padding between symbol legend entries.

lecoColumns : Basics.Float -> LegendConfig

Used by coLegend to specify the default number of columns in which to arrange symbol legend entries.

lecoCornerRadius : Basics.Float -> LegendConfig

Used by coLegend to specify the default legend corner radius.

lecoDirection : MarkOrientation -> LegendConfig

Used by coLegend to specify the default direction of a legend.

lecoDisable : Basics.Bool -> LegendConfig

Used by coLegend to specify the whether or not legends should be disabled by default.

lecoFillColor : String -> LegendConfig

Used by coLegend to specify the default background legend color.

lecoOrient : LegendOrientation -> LegendConfig

Used by coLegend to specify the default legend position relative to the main plot content.

lecoOffset : Basics.Float -> LegendConfig

Used by coLegend to specify the default offset in pixel units between the legend and the enclosing group or data rectangle.

lecoStrokeColor : String -> LegendConfig

Used by coLegend to specify the default legend border color.

lecoStrokeDash : List Basics.Float -> LegendConfig

Used by coLegend to specify the default legend border stroke dash style.

lecoStrokeWidth : Basics.Float -> LegendConfig

Used by coLegend to specify the default legend border stroke width.

lecoPadding : Basics.Float -> LegendConfig

Used by coLegend to specify the default spacing in pixel units between a legend and axis.

lecoRowPadding : Basics.Float -> LegendConfig

Used by coLegend to specify the default vertical spacing in pixel units between legend symbol entries.

lecoGradientDirection : MarkOrientation -> LegendConfig

Used by coLegend to specify the default direction of a color ramp legend.

lecoGradientLabelLimit : Basics.Float -> LegendConfig

Used by coLegend to specify the default maximum allowable length for labels in a color ramp legend.

lecoGradientLabelOffset : Basics.Float -> LegendConfig

Used by coLegend to specify the default vertical offset in pixel units for labels in a color ramp legend.

lecoGradientLength : Basics.Float -> LegendConfig

Used by coLegend to specify the default length in pixels of the primary axis of a color ramp legend.

lecoGradientOpacity : Basics.Float -> LegendConfig

Used by coLegend to specify the default opacity of a color ramp legend.

lecoGradientStrokeColor : String -> LegendConfig

Used by coLegend to specify the default color for strokes in a color ramp legend.

lecoGradientStrokeWidth : Basics.Float -> LegendConfig

Used by coLegend to specify the default width for strokes in a color ramp legend.

lecoGradientThickness : Basics.Float -> LegendConfig

Used by coLegend to specify the default thickness in pixels of a color ramp legend.

lecoGridAlign : CompositionAlignment -> LegendConfig

Used by coLegend to specify the default alignment to apply to symbol legends rows and columns.

lecoLabelAlign : HAlign -> LegendConfig

Used by coLegend to specify the default horizontal alignment of legend labels.

lecoLabelBaseline : VAlign -> LegendConfig

Used by coLegend to specify the default vertical alignment of legend labels.

lecoLabelColor : String -> LegendConfig

Used by coLegend to specify the default color for legend labels.

lecoLabelFont : String -> LegendConfig

Used by coLegend to specify the default font for legend labels.

lecoLabelFontSize : Basics.Float -> LegendConfig

Used by coLegend to specify the default font size of legend labels.

lecoLabelFontStyle : String -> LegendConfig

Used by coLegend to specify the default font style (italic etc.) of legend labels.

lecoLabelFontWeight : FontWeight -> LegendConfig

Used by coLegend to specify the default font weight of legend labels.

lecoLabelLimit : Basics.Float -> LegendConfig

Used by coLegend to specify the default maximum width for legend labels in pixel units.

lecoLabelOffset : Basics.Float -> LegendConfig

Used by coLegend to specify the default offset for legend labels.

lecoLabelOverlap : OverlapStrategy -> LegendConfig

Used by coLegend to specify the default for resolving overlapping legend labels.

lecoSymbolBaseFillColor : String -> LegendConfig

Used by coLegend to specify the default legend symbol fill color for when no fill scale color in legend encoding.

lecoSymbolBaseStrokeColor : String -> LegendConfig

Used by coLegend to specify the default legend symbol stroke color for when no stroke scale color in legend encoding.

lecoSymbolDash : List Basics.Float -> LegendConfig

Used by coLegend to specify the default legend symbol dash style in legend encoding.

lecoSymbolDashOffset : Basics.Float -> LegendConfig

Used by coLegend to specify the default legend symbol dash offset in legend encoding.

lecoSymbolDirection : MarkOrientation -> LegendConfig

Used by coLegend to specify the default direction of a symbol legend.

lecoSymbolFillColor : String -> LegendConfig

Used by coLegend to specify the default legend symbol fill color.

lecoSymbolLimit : Basics.Int -> LegendConfig

Used by coLegend to specify the default legend symbol fill color.

lecoSymbolOffset : Basics.Float -> LegendConfig

Used by coLegend to specify the default horizontal pixel offset for legend symbols.

lecoSymbolOpacity : Basics.Float -> LegendConfig

Used by coLegend to specify the default legend symbol opacity.

lecoSymbolSize : Basics.Float -> LegendConfig

Used by coLegend to specify the default legend symbol size.

lecoSymbolStrokeColor : String -> LegendConfig

Used by coLegend to specify the default legend symbol outline color.

lecoSymbolStrokeWidth : Basics.Float -> LegendConfig

Used by coLegend to specify the default legend symbol stroke width.

lecoSymbolType : Symbol -> LegendConfig

Used by coLegend to specify the default legend symbol type.

lecoNoTitle : LegendConfig

Used by coLegend to specify the default to not displaying any legend titles.

lecoTitleAlign : HAlign -> LegendConfig

Used by coLegend to specify the default horizontal alignment for legend titles.

lecoTitleAnchor : Anchor -> LegendConfig

Used by coLegend to specify the default anchoring for legend titles.

lecoTitleBaseline : VAlign -> LegendConfig

Used by coLegend to specify the default vertical alignment for legend titles.

lecoTitleColor : String -> LegendConfig

Used by coLegend to specify the default color legend titles.

lecoTitleFont : String -> LegendConfig

Used by coLegend to specify the default font for legend titles.

lecoTitleFontSize : Basics.Float -> LegendConfig

Used by coLegend to specify the default font size for legend titles.

lecoTitleFontStyle : String -> LegendConfig

Used by coLegend to specify the default font style (italic etc) for legend titles.

lecoTitleFontWeight : FontWeight -> LegendConfig

Used by coLegend to specify the default font weight for legend titles.

lecoTitleLimit : Basics.Float -> LegendConfig

Used by coLegend to specify the default maximum size in pixel units for legend titles.

lecoTitleLineHeight : Basics.Float -> LegendConfig

Used by coLegend to specify the default line height for multi-line legend titles.

lecoTitleOpacity : Basics.Float -> LegendConfig

Used by coLegend to specify the default opacity of a legend's title.

lecoTitlePadding : Basics.Float -> LegendConfig

Used by coLegend to specify the default spacing in pixel units between title and legend.

lecoUnselectedOpacity : Basics.Float -> LegendConfig

Used by coLegend to specify the default opacity of unselected legend items when made interactive via paBindLegend.

lecoX : Basics.Float -> LegendConfig

Used by coLegend to specify the default x-position of legend group in pixel units for absolute positioning when leOrient is set to loNone.

lecoY : Basics.Float -> LegendConfig

Used by coLegend to specify the default y-position of legend group in pixel units for absolute positioning when leOrient is set to loNone.

8.3.3 Scale Configuration

See the Vega-Lite scale configuration documentation

sacoBooExpr : String -> (Basics.Bool -> ScaleConfig) -> ScaleConfig

Provide an expression to a scale property configuration function requiring a Boolean value. Used by coScale.

sacoNumExpr : String -> (number -> ScaleConfig) -> ScaleConfig

Provide an expression to a scale property configuration function requiring a numeric value. Used by coScale.

sacoBandPaddingInner : Basics.Float -> ScaleConfig

Default inner padding for x and y band-ordinal scales. Used by coScale.

sacoBarBandPaddingInner : Basics.Float -> ScaleConfig

Default inner padding for x and y band-ordinal scales of bar marks. Used by coScale.

sacoRectBandPaddingInner : Basics.Float -> ScaleConfig

Default inner padding for x and y band-ordinal scales of rect marks. Used by coScale.

sacoBandPaddingOuter : Basics.Float -> ScaleConfig

Default outer padding for x and y band-ordinal scales. Used by coScale.

sacoContinuousPadding : Basics.Float -> ScaleConfig

Default padding for continuous scales. Used by coScale.

sacoPointPadding : Basics.Float -> ScaleConfig

Default padding for point-ordinal scales. Used by coScale.

sacoClamp : Basics.Bool -> ScaleConfig

Whether or not by default values that exceed the data domain are clamped to the min/max range value. Used by coScale.

sacoMaxBandSize : Basics.Float -> ScaleConfig

Default maximum value for mapping quantitative fields to a bar's size/bandSize. Used by coScale.

sacoMinBandSize : Basics.Float -> ScaleConfig

Default minimum value for mapping quantitative fields to a bar's size/bandSize. Used by coScale.

sacoMaxFontSize : Basics.Float -> ScaleConfig

Default maximum value for mapping a quantitative field to a text mark's size. Used by coScale.

sacoMinFontSize : Basics.Float -> ScaleConfig

Default minimum value for mapping a quantitative field to a text mark's size. Used by coScale.

sacoMaxOpacity : Basics.Float -> ScaleConfig

Default maximum opacity (in the range [0, 1]) for mapping a field to opacity. Used by coScale.

sacoMinOpacity : Basics.Float -> ScaleConfig

Default minimum opacity (0 to 1) for mapping a field to opacity. Used by coScale.

sacoMaxSize : Basics.Float -> ScaleConfig

Default maximum size for point-based scales. Used by coScale.

sacoMinSize : Basics.Float -> ScaleConfig

Default minimum size for point-based scales (when not forced to start at zero). Used by coScale.

sacoMaxStrokeWidth : Basics.Float -> ScaleConfig

Default maximum stroke width for rule, line and trail marks. Used by coScale.

sacoMinStrokeWidth : Basics.Float -> ScaleConfig

Default minimum stroke width for rule, line and trail marks. Used by coScale.

sacoRound : Basics.Bool -> ScaleConfig

Whether or not numeric values are rounded to integers when scaling. Useful for snapping to the pixel grid. Used by coScale.

sacoUseUnaggregatedDomain : Basics.Bool -> ScaleConfig

Whether or not to use the source data range before aggregation. Used by coScale.

sacoXReverse : Basics.Bool -> ScaleConfig

Whether or not to reverse the x-scaling by default (useful for right to left charts). Used by coScale.

sacoZero : Basics.Bool -> ScaleConfig

Whether or not to default to include zero in any continuous scaling. Used by coScale.

8.3.4 Scale Range Configuration

See the Vega-Lite scheme configuration documentation.

racoCategory : String -> RangeConfig

Default color scheme for categorical ranges. Used by coRange.

racoDiverging : String -> RangeConfig

Default diverging color scheme. Used by coRange.

racoHeatmap : String -> RangeConfig

Default 'heatmap' color scheme. Used by coRange.

racoOrdinal : String -> RangeConfig

Default ordinal color scheme. Used by coRange.

racoRamp : String -> RangeConfig

Default ramp (continuous) color scheme. Used by coRange.

racoSymbols : List Symbol -> RangeConfig

Default set of symbols for shape encoding. Used by coRange.

racoSymbolsExpr : String -> RangeConfig

Default set of symbols for shape encoding determined by the value of the given expression. Used by coRange.

8.3.5 Title Configuration

Unlike title title configuration applies to all titles if multiple views are created. See the Vega-Lite title configuration documentation

ticoAnchor : Anchor -> TitleConfig

Configure default title anchor position via coTitle.

ticoAngle : Basics.Float -> TitleConfig

Configure default title text orientation (degrees from horizontal) via coTitle.

ticoBaseline : VAlign -> TitleConfig

Configure default vertical alignment of title text via coTitle.

ticoColor : String -> TitleConfig

Configure default title color when via coTitle.

ticoDx : Basics.Float -> TitleConfig

Configure default delta offset of title and subtitle x-position via coTitle.

ticoDy : Basics.Float -> TitleConfig

Configure default delta offset of title and subtitle y-position via coTitle.

ticoFont : String -> TitleConfig

Configure default title font via coTitle.

ticoFontSize : Basics.Float -> TitleConfig

Configure default title font size via coTitle.

ticoFontStyle : String -> TitleConfig

Configure default title font style (italic etc.) via coTitle.

ticoFontWeight : FontWeight -> TitleConfig

Configure default title font weight via coTitle.

ticoLineHeight : Basics.Float -> TitleConfig

Configure default title line height (vertical spacing) via coTitle.

ticoSubtitleColor : String -> TitleProperty

Configure default color of a subtitle via coTitle.

ticoSubtitleFont : String -> TitleConfig

Configure default font name of a subtitle via coTitle.

ticoSubtitleFontSize : Basics.Float -> TitleConfig

Configure default font size of a subtitle via coTitle.

ticoSubtitleFontStyle : String -> TitleConfig

Configure default font style of a subtitle such as "normal" or "italic" via coTitle.

ticoSubtitleFontWeight : FontWeight -> TitleConfig

Configure default font weight of a subtitle via coTitle.

ticoSubtitleLineHeight : Basics.Float -> TitleConfig

Configure default line height in pixels of each line of text in a subtitle via coTitle.

ticoSubtitlePadding : Basics.Float -> TitleConfig

Configure default padding in pixels between title and subtitle text via coTitle.

ticoFrame : TitleFrame -> TitleConfig

Configure title position anchor via coTitle. Can be relative to the full bounding box (tfBounds) or the group in which the titled visualization belongs (tfGroup).

ticoLimit : Basics.Float -> TitleConfig

Configure default maximum title length in pixel units via coTitle.

ticoOffset : Basics.Float -> TitleConfig

Configure default title offset in pixel units relative to the chart body. Used by coTitle.

ticoOrient : Side -> TitleConfig

Configure default placement of titles relative to the chart body via coTitle.

ticoStyle : List String -> TitleConfig

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.

ticoZIndex : Basics.Int -> TitleConfig

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.

8.3.6 View Configuration

See the Vega-Lite view configuration documentation

vicoBackground : List ViewBackground -> ViewConfig

Configure the default single view style via coView.

vicoContinuousWidth : Basics.Float -> ViewConfig

Configure default width of single views when the plot has continuous x-field via coView.

vicoContinuousHeight : Basics.Float -> ViewConfig

Configure default height of single views when the plot has continuous y-field via coView.

vicoCursor : Cursor -> ViewConfig

Configure the default cursor for single views via coView.

vicoDiscreteWidth : Basics.Float -> ViewConfig

Configure default width of single views when the plot has discrete x-field via coView.

vicoDiscreteHeight : Basics.Float -> ViewConfig

Configure default height of single views when the plot has discrete y-field via coView.

vicoClip : Basics.Bool -> ViewConfig

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.

vicoCornerRadius : Basics.Float -> ViewConfig

Configure the default radius in pixels of rounded rectangle corners via coView.

vicoFill : Maybe String -> ViewConfig

Configure default fill color for single views via coView.

vicoFillOpacity : Basics.Float -> ViewConfig

Configure default fill opacity for single views via coView.

vicoOpacity : Basics.Float -> ViewConfig

Configure default overall opacity for single views via coView.

vicoStep : Basics.Float -> ViewConfig

Configure default step size for x/y discrete fields via coView.

vicoStroke : Maybe String -> ViewConfig

Configure the default stroke color for single views. If Nothing is provided, no strokes are drawn around the view. Used by coView.

vicoStrokeCap : StrokeCap -> ViewConfig

Configure the default stroke cap line-ending style for single views via coView.

vicoStrokeDash : List Basics.Float -> ViewConfig

Configure the default stroke dash style for single views via coView.

vicoStrokeDashOffset : Basics.Float -> ViewConfig

Configure the default stroke dash offset for single views via coView.

vicoStrokeJoin : StrokeJoin -> ViewConfig

Configure the default stroke line-joining style for single views via coView.

vicoStrokeMiterLimit : Basics.Float -> ViewConfig

Configure the default stroke mitre limit at which to bevel a line join in single views via coView.

vicoStrokeOpacity : Basics.Float -> ViewConfig

Configure the default stroke opacity for single views via coView.

vicoStrokeWidth : Basics.Float -> ViewConfig

Confgure the default stroke width of single views via coView.

anStart : Anchor

Anchor some text at its start. Used by axTitleAnchor, axcoTitleAnchor, leTitleAnchor, lecoTitleAnchor, hdLabelAnchor, hdTitleAnchor, tiAnchor and ticoAnchor.

anMiddle : Anchor

Anchor some text in its start. Used by axTitleAnchor, axcoTitleAnchor, leTitleAnchor, lecoTitleAnchor, hdLabelAnchor, hdTitleAnchor, tiAnchor and ticoAnchor.

anEnd : Anchor

Anchor some text at its end.

anExpr : String -> Anchor

Specify an anchor style ("start", "middle", "end") with an expression. Used by axTitleAnchor, axcoTitleAnchor, leTitleAnchor, lecoTitleAnchor, hdLabelAnchor, hdTitleAnchor, tiAnchor and ticoAnchor.

ftVerbal : FieldTitleProperty

Field titles to be displayed fully, such as 'Sum of field', 'Year of date' etc. Used by coFieldTitle.

ftFunction : FieldTitleProperty

Field titles to be displayed as 'SUM(field)', 'YEAR(date)' etc. Used by coFieldTitle.

ftPlain : FieldTitleProperty

Field titles to be displayed simply by their name without additional text. Used by coFieldTitle.

8.3.7 Facet Configuration

See the Vega-Lite facet configuration documentation.

facoColumns : Basics.Int -> FacetConfig

Configuration option for the maximum number of columns to use in a faceted flow layout. Used by coFacet.

facoSpacing : Basics.Float -> FacetConfig

Configuration option for the spacing in pixels between sub-views in a faceted view. Used by coFacet.

8.3.8 Concatenated View Configuration

See the Vega-Lite concat configuration documentation.

cocoColumns : Basics.Int -> ConcatConfig

Configuration option for the maximum number of columns to use in a concatenated flow layout. Used by coConcat.

cocoSpacing : Basics.Float -> ConcatConfig

Configuration option for the spacing in pixels between sub-views in a concatenated view. Used by coConcat.

8.3.9 Locale Configuration

See the Vega locale documentation.

loDecimal : String -> LocaleProperty

Symbol used to indicate decimal point as part of a locale specification.

loThousands : String -> LocaleProperty

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.

loGrouping : Basics.Int -> LocaleProperty

Number of digits to represent what is by default a 'thousands' group, as part of a locale specification.

loCurrency : String -> String -> LocaleProperty

Indicate prefix (first parameter) and suffix (second parameter) currency symbols as part of a locale specification. For example

loCurrency "£" ""

loNumerals : List String -> LocaleProperty

List of 10 symbols to replace the numerals 0–9 as part of a locale specification.

loPercent : String -> LocaleProperty

Symbol used to indicate percentages as part of a locale specification.

loMinus : String -> LocaleProperty

Symbol used to indicate minus/negative as part of a locale specification.

loNan : String -> LocaleProperty

Symbol used to indicate a 'not-a-number' value, as part of a locale specification.

loDateTime : String -> LocaleProperty

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"

loDate : String -> LocaleProperty

Default format of date representation as part of a locale specification. Uses d3-time-format symbols. For example,

loDate "%_d %B %Y"

loTime : String -> LocaleProperty

Default format of time representation as part of a locale specification. Uses d3-time-format symbols. For example,

loTime "%I:%M %p"

loPeriods : String -> String -> LocaleProperty

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

loDays : List String -> LocaleProperty

List of the text representing the 7 days of the week (starting Sunday) as part of a locale specification.

loShortDays : List String -> LocaleProperty

List of the text representing the 7 abbreviated days of the week (starting Sunday) as part of a locale specification.

loMonths : List String -> LocaleProperty

List of the text representing the 12 months of the year (starting January) as part of a locale specification.

loShortMonths : List String -> LocaleProperty

List of the text representing the 12 abbreviated months of the year (starting January) as part of a locale specification.

9. General Data Functions

In addition to more general data types like integers and strings, the following types can carry data used in specifications and Vega-Lite parameters.

boo : Basics.Bool -> DataValue

A Boolean data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.

true : DataValue

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.

false : DataValue

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.

dt : List DateTime -> DataValue

Date-time data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.

num : Basics.Float -> DataValue

A numeric data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.

str : String -> DataValue

A string data value. Used by dataRow, paValue, pDatum, mDatum, tDatum, datumArray, inDatumOptions, imNewValue, fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq and fiOneOf.

datumExpr : String -> DataValue

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.

dataExpr : String -> DataValues

A list of data values created by the given expression. Used by dataColumn, fiOneOf, imKeyVals, soCustom, axValues, leValues, paValues, inDataOptions, dataArrays and daConcat.

datumArray : List DataValue -> DataValue

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 ] ]

dataArrays : List DataValues -> DataValues

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" ]
    ]

dataObject : List ( String, DataValue ) -> DataValue

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

dataObjects : List (List ( String, DataValue )) -> DataValues

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.

nullValue : DataValue

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.

daConcat : DataValues -> DataValue

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 ])) ]

boos : List Basics.Bool -> DataValues

A list of Boolean data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).

dts : List (List DateTime) -> DataValues

List of date-time data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).

nums : List Basics.Float -> DataValues

List of numeric data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).

strs : List String -> DataValues

A list of string data values. Used when declaring inline data with dataColumn, filtering (fiOneOf), imputation (imKeyVals) and customised sorting (soCustom).

9.1 Temporal Data

See the Vega-Lite dateTime documentation and the Vega-Lite time unit documentation.

dtYear : Basics.Int -> DateTime

A year. Used by dt, dtRange, doMinDt and doMaxDt.

dtQuarter : Basics.Int -> DateTime

Year quarter (1 to 4). Used by dt, dtRange, doMinDt and doMaxDt.

dtMonth : MonthName -> DateTime

Month of a year. Used by dt, dtRange, doMinDt and doMaxDt.

dtDate : Basics.Int -> DateTime

Day of the month (1 to 31). Used by dt, dtRange, doMinDt and doMaxDt.

dtDay : DayName -> DateTime

Day of the week. Used by dt, dtRange, doMinDt and doMaxDt.

dtHour : Basics.Int -> DateTime

Hour of the day (0=midnight, 1=1am, 23=11pm etc.). Used by dt, dtRange, doMinDt and doMaxDt.

dtMinute : Basics.Int -> DateTime

Minute of an hour (0-59). Used by dt, dtRange, doMinDt and doMaxDt.

dtSecond : Basics.Int -> DateTime

Second of a minute (0-59). Used by dt, dtRange, doMinDt and doMaxDt.

dtMillisecond : Basics.Int -> DateTime

Millisecond of a second (0-999). Used by dt, dtRange, doMinDt and doMaxDt.


type MonthName
    = Jan
    | Feb
    | Mar
    | Apr
    | May
    | Jun
    | Jul
    | Aug
    | Sep
    | Oct
    | Nov
    | Dec

Identify a month of the year.


type DayName
    = Mon
    | Tue
    | Wed
    | Thu
    | Fri
    | Sat
    | Sun

Day of the week.

date : TimeUnit

Day of the month (1-31) time unit used for discretizing temporal data. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

dayOfYear : TimeUnit

Indicate temporal binning by day of the year, so a 10 year sequence would have up to 366 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

day : TimeUnit

Day of the week used for discretizing temporal data. This will therefore discretize any temporal sequence into a maximum of 7 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

dayHours : TimeUnit

Hour of the day through the week used for discretizing temporal data. This will therefore discretize any temporal sequence into a maximum of 7*24 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

dayHoursMinutes : TimeUnit

Minute through the week used for discretizing temporal data. This will therefore discretize any temporal sequence into a maximum of 7*24*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

dayHoursMinutesSeconds : TimeUnit

Second through the week used for discretizing temporal data. This will therefore discretize any temporal sequence into a maximum of 7*24*60*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

hours : TimeUnit

Hour of the day time unit used for discretizing temporal data.

hoursMinutes : TimeUnit

Hours and minutes time unit used for discretizing temporal data.

hoursMinutesSeconds : TimeUnit

Hours, minutes and seconds time unit used for discretizing temporal data.

milliseconds : TimeUnit

Milliseconds time unit used for discretizing temporal data.

minutes : TimeUnit

Minute of the hour time unit used for discretizing temporal data.

minutesSeconds : TimeUnit

Minutes and seconds time unit used for discretizing temporal data.

month : TimeUnit

Month of the year used for discretizing temporal data. This will ignore year so useful for looking at monthly seasonal patterns through the year.

monthDate : TimeUnit

Day of the year for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns through the year.

monthDateHours : TimeUnit

Hour of the year used for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns with hourly resolution.

monthDateHoursMinutes : TimeUnit

Minute of the year used for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns with one-minute resolution.

monthDateHoursMinutesSeconds : TimeUnit

Second of the year used for discretizing temporal data. This will ignore year so useful for looking at seasonal patterns with one-second resolution.

quarter : TimeUnit

Year quarter time unit used for discretizing temporal data.

quarterMonth : TimeUnit

Year quarter and month time unit used for discretizing temporal data.

seconds : TimeUnit

Second of a minute time unit used for discretizing temporal data.

secondsMilliseconds : TimeUnit

Seconds and milliseconds time unit used for discretizing temporal data.

week : TimeUnit

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.

weekDay : TimeUnit

Indicate temporal binning by day of week though the year, so a 10 year sequence would have up to 53*7 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

weekDayHours : TimeUnit

Indicate temporal binning by hour of day though the year, so a 10 year sequence would have up to 52*7*24 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

weekDayHoursMinutes : TimeUnit

Indicate temporal binning by minute though the year, so a 10 year sequence would have up to 52*7*24*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

weekDayHoursMinutesSeconds : TimeUnit

Indicate temporal binning by the second though the year, so a 10 year sequence would have up to 52*7*24*60*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

year : TimeUnit

Indicate temporal binning into year categories. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearQuarter : TimeUnit

Indicate temporal binning with a resolution of quarters so a ten year sequence would have up to 10*4 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearQuarterMonth : TimeUnit

Indicate temporal binning with a resolution of months so a ten year sequence would have up to 10*12 bins. Unlike yearMonth, this will also label bins with quarters. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearMonth : TimeUnit

Indicate temporal binning with a resolution of months so a ten year sequence would have up to 10*12 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearMonthDate : TimeUnit

Indicate temporal binning with a resolution of days so a ten year sequence would have up to approximately 10*12*31 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearMonthDateHours : TimeUnit

Indicate temporal binning with a resolution of hours so a ten year sequence would have up to approximately 10*12*31*24 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearMonthDateHoursMinutes : TimeUnit

Indicate temporal binning with a resolution of minutes so a ten year sequence would have up to approximately 10*12*31*24*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearMonthDateHoursMinutesSeconds : TimeUnit

Indicate temporal binning with a resolution of seconds so a ten year sequence would have up to approximately 10*12*31*24*60*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearWeek : TimeUnit

Indicate temporal binning with a resolution of weeks so a ten year sequence would have up to 10*52 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearWeekDay : TimeUnit

Indicate temporal binning with a resolution of day of week so a ten year sequence would have up to 10*52*7 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearWeekDayHours : TimeUnit

Indicate temporal binning with a resolution of hours so a ten year sequence would have up to 10*52*7*24 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearWeekDayHoursMinutes : TimeUnit

Indicate temporal binning with a resolution of minutes so a ten year sequence would have up to 10*52*7*24*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearWeekDayHoursMinutesSeconds : TimeUnit

Indicate temporal binning with a resolution of seconds so a ten year sequence would have up to 10*52*7*24*60*60 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

yearDayOfYear : TimeUnit

Indicate temporal binning with a resolution of days so a ten year sequence would have up to approximately 10*365 bins. Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

utc : TimeUnit -> TimeUnit

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.

binnedTimeUnit : TimeUnit -> TimeUnit

Indicate time units are already binned at the given time unit. Will adjust axis title bins accordingly.

encoding
    << position X
        [ pName "date"
        , pTemporal
        , pTimeUnit (binned yearMonth)
        ]

Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs.

tuMaxBins : Basics.Int -> TimeUnit

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 366

Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, utc and tuStep.

tuStep : Basics.Float -> TimeUnit -> TimeUnit

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 yearMonthDate

Used by pTimeUnit, mTimeUnit, tTimeUnit, hTimeUnit, oTimeUnit, dTimeUnit, fTimeUnit, timeUnitAs, niInterval, and utc.

10. Type Reference

Types that are not specified directly, provided here for reference with links to the functions that generate them.


type Anchor

Generated by anStart, anMiddle, anEnd and anExpr.


type Aria

Generated by arEnable, arDisable, arDescription and arExpr.


type Arrangement

Generated by arFlow, arColumn, arRow and arLayer.


type Autosize

Generated by asContent, asFit, asFitX, asFitY, asNone, asPad, asPadding and asResize.


type AxisProperty

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.


type AxisConfig

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.


type BinProperty

Generated by biAnchor, biBase, biDivide, biExtent,biSelectionExtent, biMaxBins, biMinStep, biNice, biStep and biSteps.


type BlendMode

Generated by bmNormal, bmMultiply, bmScreen, bmOverlay, bmDarken, bmLighten, bmColorDodge, bmColorBurn, bmHardLight, bmSoftLight, bmDifference, bmExclusion, bmHue, bmSaturation, bmColor, bmLuminosity and bmExpr.


type BooleanOp

Generated by expr, fiOp, fiOpTrans, bParam, and, or and not.


type Bounds

Generated by boFull and boFlush.


type CInterpolate

Generated by cubeHelix, cubeHelixLong, hcl, hclLong, hsl, hslLong, lab and rgb.


type Channel

Generated by chX, chY, chX2, chY2, chXOffset, chYOffset, chColor, chOpacity, chShape, chStrokeDash and chSize.


type ClipRect

Generated by noClip, clipRect and clipRectExpr.


type ColorGradient

Generated by grLinear and grRadial.


type CompositionAlignment

Generated by caNone, caEach and caAll.


type ConcatConfig

Generated by cocoColumns and cocoSpacing.


type ConditionalAxisProperty

Generated by cAxLabelAlign, cAxLabelBaseline, cAxLabelColor, cAxLabelFont, cAxLabelFontSize, cAxLabelFontStyle, cAxLabelFontWeight, cAxLabelOffset, cAxLabelOpacity, cAxLabelPadding, cAxTickColor, cAxTickDash, cAxTickDashOffset, cAxTickOpacity, cAxTickSize, cAxTickWidth, cAxGridColor, cAxGridDash, cAxTickDashOffset, cAxGridOpacity and cAxGridWidth.


type ConfigurationProperty

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.


type Cursor

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.


type DataType

Generated by foBoo, foNum, foDate and foUtc.


type DataValue

Generated by boo, true, false, dt, num, str, datumExpr, daConcat, dataObject, datumArray and nullValue.


type DataValues

Generated by boos, dts, nums, strs, dataExpr, dataArrays and dataObjects.


type DateTime

Generated by dtYear, dtQuarter, dtMonth, dtDate, dtDay, dtHour, dtMinute, dtSecond, dtMillisecond and fromPosixTime.


type DensityProperty

Generated by dnGroupBy, dnCumulative, dnCounts, dnBandwidth, dnExtent, dnMinSteps, dnMaxSteps, dnSteps and dnAs.


type DetailChannel

Generated by dName, dQuant, dNominal, dOrdinal, dTemporal, dGeo, dAggregate, dBin and dTimeUnit.


type FacetChannel

Generated by fName, fQuant, fNominal, fOrdinal, fTemporal, fGeo, fAggregate, fBin, fSort, fHeader, fTimeUnit, fAlign, fCenter and fSpacing.


type FacetConfig

Generated by facoColumns and facoSpacing.


type FacetMapping

Generated by columnBy and rowBy.


type FieldTitleProperty

Generated by ftVerbal, ftFunction and ftPlain.


type Filter

Generated by fiEqual, fiLessThan, fiLessThanEq, fiGreaterThan, fiGreaterThanEq, fiExpr, fiCompose, fiSelection, fiSelectionEmpty, fiOneOf, fiRange and fiValid.


type FilterRange

Generated by numRange and dtRange.


type Format

Generated by csv, dsv, tsv, arrow, parse, jsonProperty, topojsonFeature and topojsonMesh.


type Geometry

Generated by geoPoint, geoPoints, geoLine, geoLines, geoPolygon and geoPolygons.


type GradientProperty

Generated by grX1, grY1, grX2, grY2, grR1, grR2 and grStops.


type GraticuleProperty

Generated by grExtent, grExtentMajor, grExtentMinor, grStep, grExtentMajor, grExtentMinor and grPrecision.


type HAlign

Generated by haLeft, haCenter, haRight and haExpr.


type HeaderProperty

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.


type HyperlinkChannel

Generated by hName, hRepeat, hQuant, hNominal, hOrdinal, hTemporal, hGeo, hBin, hBinned, hAggregate, hTimeUnit, hCondition and hStr.


type ImMethod

Generated by imValue, imMean, imMedian, imMax and imMin.


type ImputeProperty

Generated by imKeyVals, imKeyValSequence imFrame, imGroupBy, imMethod and imNewValue.


type InputProperty

Generated by inDebounce, inElement, inOptions, inLabelledOptions, inDatumOptions, inLabelledDatumOptions, inDataOptions, inLabelledDataOptions, inMin, inMax, inName, inStep and inPlaceholder.


type KeyChannel

Generated by kName and kQuant, kNominal, kOrdinal, kTemporal and kGeo.


type Legend

Generated by leGradient and leSymbol.


type LegendConfig

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.


type LegendOrientation

Generated by loLeft, loTopLeft, loTop, loTopRight, loRight, loBottomRight, loBottom, loBottomLeft and loNone.


type LegendProperty

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.


type LineMarker

Generated by lmMarker and lmNone.


type LoessProperty

Generated by lsGroupBy, lsBandwidth and lsAs.


type LookupFields

Generated by luFields, luFieldsAs, luAs, luFieldsWithDefault, luFieldsAsWithDefault and luAsWithDefault


type Mark

Generated by arc, area, bar, boxplot, circle, errorband, errorbar, geoshape, image, line, point, rect, rule, square, textMark, tick and trail.


type MarkChannel

Generated by mName, mDatum, mQuant, mNominal, mOrdinal, mTemporal, mGeo, mRepeat, mRepeatDatum, mScale, mBand, mBin, mBinned mTimeUnit, mTitle, mAggregate, mLegend, mSort, mCondition, mConditions, mPath, mNum, mStr and mBoo.


type MarkInterpolation

Generated by miBasis, miBasisClosed, miBasisOpen, miBundle, miCardinal, miCardinalClosed, miCardinalOpen, miLinear, miLinearClosed, miMonotone, miStepwise, miStepAfter, miStepBefore and miExpr.


type MarkOrientation

Generated by moHorizontal and moVertical.


type MarkProperty

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, maMinBandSize, 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.


type Operation

Generated by opArgMax, opArgMin, opCI0, opCI1, opCount, opDistinct, opMax, opMean, opMedian, opMin, opMissing, opProduct, opQ1, opQ3, opStderr, opStdev, opStdevP, opSum, opValid, opVariance and opVarianceP.


type OrderChannel

Generated by oName, oRepeat, oQuant, oNominal, oOrdinal, oTemporal, oGeo, oBin, oAggregate, oTimeUnit, oSort, oNum, oCondition and oConditions.


type OverlapStrategy

Generated by osNone, osGreedy, osParity and [osExpr].


type Padding

Generated by paSize, paEdges and paEdgesExpr.


type ParamProperty

Generated by paBind, paBindings, paBindLegend, paBindScales, paExpr, paValue, paValues and paSelect.


type PBinding

Generated by ipRange, ipCheckbox, ipRadio, ipSelect, ipText, ipNumber, ipDate, ipTime, ipMonth, ipWeek, ipDateTimeLocal, ipTel and ipColor.


type PivotProperty

Generated by piGroupBy, piLimit and piOp.


type PointMarker

Generated by pmNone, pmTransparent and pmMarker.


type PositionChannel

Generated by pName, pDatum, pQuant, pNominal, pOrdinal, pTemporal, pGeo, pRepeat, pRepeatDatum, pBin, pBinned, pTimeUnit, pTitle, pAggregate, pScale, pAxis, pSort, pBandPosition, pStack, pWidth, pHeight, pNum and pImpute.


type Predicate

Generated by prParam, prParamEmpty and prTest.


type Projection

Generated by albers, albersUsa, azimuthalEqualArea, azimuthalEquidistant, conicConformal, conicEqualArea, conicEquidistant, equalEarth, equirectangular, gnomonic, identityProjection, mercator, naturalEarth1 orthographic, stereographic, transverseMercator, customProjection and prExpr.


type ProjectionProperty

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.


type QuantileProperty

Generated by qtGroupBy, qtProbs, qtStep and qtAs.


type RangeConfig

Generated by racoCategory, racoDiverging, racoHeatmap, racoOrdinal, racoRamp, racoSymbols and .


type RegressionMethod

Generated by rgLinear, rgLog, rgExp, rgPow, rgQuad and rgPoly.


type RegressionProperty

Generated by rgGroupBy, rgMethod, rgOrder, rgExtent, rgParams and rgAs.


type RepeatFields

Generated by rowFields, columnFields and layerFields.


type Resolution

Generated by reShared and reIndependent.


type Resolve

Generated by reAxis, reLegend and reScale.


type Scale

Generated by scLinear, scPow, scSqrt, scLog, scSymLog, scTime, scUtc, scOrdinal, scBand, scPoint, scBinOrdinal, scQuantile, scQuantize and scThreshold.


type ScaleDomain

Generated by doNums, doMin, doMid, doMax, doStrs, doDts, doDtsExpr, doMinDt, doMinDtExpr, doMaxDt, doMaxDtExpr, doSelection, doSelectionChannel, doSelectionField, doUnionWith and doUnaggregated.


type ScaleNice

Generated by niTrue, niFalse, niMillisecond, niSecond, niMinute, niHour, niDay, niWeek, niMonth, niYear, niTickCount, niInterval and niExpr.


type ScaleProperty

Generated by scType, scDomain, scDomainExpr, scRange, scScheme, scSchemeExpr, scAlign, scPadding, scPaddingInner, scPaddingOuter, scReverse, scRound, scClamp, scInterpolate, scNice, scExponent, scConstant, scBase and scZero.


type ScaleConfig

Generated by sacoBandPaddingInner, sacoBandPaddingOuter, sacoBarBandPaddingInner, sacoRectBandPaddingInner, sacoClamp, sacoContinuousPadding, sacoMaxBandSize, sacoMinBandSize, sacoMaxFontSize, sacoMinFontSize, sacoMaxOpacity, sacoMinOpacity, sacoMaxSize, sacoMinSize, sacoMaxStrokeWidth, sacoMinStrokeWidth, sacoPointPadding, sacoRound, sacoUseUnaggregatedDomain, sacoXReverse and sacoZero.


type ScaleRange

Generated by raNums, raExprs, raMin, raMax, raStrs, raNumLists, raName and raField.


type Selection

Generated by sePoint and seInterval.


type SelectionMarkProperty

Generated by smFill, smFillOpacity, smStroke, smStrokeDash, smStrokeDashOffset, smStrokeOpacity, smStrokeWidth and smCursor.


type SelectionProperty

Generated by seClear, seEncodings,seFields, seNearest, seOn, seResolve, seSelectionMark, seToggle, seTranslate and seZoom.


type SelectionResolution

Generated by seGlobal, seUnion and seIntersection.


type Side

Generated by siLeft, siRight, siTop, siBottom and siExpr.


type SortField

Generated by stAscending, wiAscending, stDescending and wiDescending.


type SortProperty

Generated by soAscending, soDescending, soByField, soByChannel, soByRepeat and soCustom.


type StackOffset

Generated by stZero, stCenter, stNormalize and stNone.


type StackProperty

Generated by stOffset and stSort.


type StrokeCap

Generated by caButt, caRound, caSquare and caExpr.


type StrokeJoin

Generated by joMiter, joRound, joBevel and joExpr.


type SummaryExtent

Generated by exCi, exIqr, exIqrScale, exRange, exStderr and exStdev.


type Symbol

Generated by symCircle, symSquare, symCross, symDiamond, symTriangleUp, symTriangleDown, symTriangleLeft, symTriangleRight, symPath, symStroke, symArrow, symWedge,symTriangle and symExpr.


type TextChannel

Generated by tName, tRepeat, tQuant, tNominal, tOrdinal, tTemporal, tGeo, tBin, tBinned, tAggregate, tTimeUnit, tTitle, tCondition, tConditions, tFormat, tFormatAsNum, tFormatAsTemporal, tFormatAsCustom, tStr and tDatum.


type TimeUnit

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, [binnedTimeUnit](#binnedTimeUnit], tuMaxBins and tuStep.


type alias TitleConfig =
TitleProperty

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.


type TitleFrame

Generated by tfBounds, tfGroup and tfExpr.


type TitleProperty

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.


type TogglePredicate

Generate by tpFalse, tpShiftKey, tpCtrlKey, tpAltKey and tpExpr.


type TooltipContent

Generated by ttEncoding, ttData and ttNone.


type VAlign

Generated by vaTop, vaLineTop, vaMiddle, vaAlphabetic, vaBottom, vaLineBottom and vaExpr.


type ViewBackground

Generated by viewStyle, viewCornerRadius, viewFill, viewFillOpacity, viewOpacity, viewStroke, viewStrokeOpacity, viewStrokeWidth, viewStrokeCap, viewStrokeDash, viewStrokeDashOffset, viewStrokeJoin and viewStrokeMiterLimit.


type ViewConfig

Generated by vicoBackground, vicoClip, vicoContinuousHeight, vicoContinuousWidth, vicoCursor, vicoDiscreteHeight, vicoDiscreteWidth, vicoCornerRadius, vicoFill, vicoFillOpacity, vicoOpacity, vicoStep, vicoStroke, vicoStrokeCap, vicoStrokeDash, vicoStrokeDashOffset, vicoStrokeJoin, vicoStrokeMiterLimit, vicoStrokeOpacity and vicoStrokeWidth.


type Window

Generated by wiAggregateOp, wiOp, wiParam and wiField.


type WOperation

Generated by woRowNumber, woRank, woDenseRank, woPercentRank, woCumeDist, woPercentile, woLag, woLead, woFirstValue, woLastValue, and woNthValue.


type WindowProperty

Generated by wiFrame, wiIgnorePeers, wiGroupBy and wiSort.

11. Deprecated


type AxisChoice

Deprecated. Axis choices are now specified with coAxisXFilter and coAxisYFilter.

axX : AxisChoice

Deprecated. Use coAxisXFilter instead.

axY : AxisChoice

Deprecated. UsecoAxisYFilter instead.

dtMonthNum : MonthName -> DateTime

Deprecated: Instead use dtMonth instead. This will likely be removed in the next major release as it was redundant.