-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Create Vega and Vega-Lite visualizations.
--   
--   This is an almost-direct port of elm-vega
--   (<a>http://package.elm-lang.org/packages/gicentre/elm-vega/2.2.1</a>)
--   to Haskell.
@package hvega
@version 0.1.0.3


-- | This is essentially a straight port of the <a>Elm Vega Lite module</a>
--   (version 2.2.1). It allows users to create a Vega-Lite specification,
--   targeting version 2 of the <a>JSON schema</a>. The ihaskell-hvega
--   module provides an easy way to embed Vega-Lite visualizations in an
--   IHaskell notebook (using <a>Vega-Embed</a>).
--   
--   The major change to version 2.2.1 of the Elm version is that the type
--   representing the full Vega-Lite specification - that is, the return
--   value of <a>toVegaLite</a> - is not a <a>VLSpec</a> (an alias for
--   <a>Value</a>) but is instead a newtype around this (<a>VegaLite</a>).
--   There are also some minor changes to the exported types and symbols
--   (e.g. <a>Utc</a> is exported rather than <tt>utc</tt> and <tt>bin</tt>
--   is not exported).
--   
--   Note that this module exports several symbols that are exported by the
--   Prelude, namely <a>Left</a>, <a>Right</a>, <a>filter</a>,
--   <a>lookup</a>, and <a>repeat</a>.
--   
--   <h2>Example</h2>
--   
--   <pre>
--   let desc = "A very exciting bar chart"
--   
--       dat = dataFromRows [Parse [("start", FoDate "%Y-%m-%d")]]
--             . dataRow [("start", Str "2011-03-25"), ("count", Number 23)]
--             . dataRow [("start", Str "2011-04-02"), ("count", Number 45)]
--             . dataRow [("start", Str "2011-04-12"), ("count", Number 3)]
--   
--       barOpts = [MOpacity 0.4, MColor "teal"]
--   
--       enc = encoding
--             . position X [PName "start", PmType Temporal, PAxis [AxTitle "Inception date"]]
--             . position Y [PName "count", PmType Quantitative]
--   
--       in toVegaLite [description desc, background "white", dat [], mark Bar barOpts, enc []]
--   </pre>
--   
module Graphics.Vega.VegaLite

-- | Convert a list of Vega-Lite specifications into a single JSON object
--   that may be passed to Vega-Lite for graphics generation. Commonly
--   these will include at least a data, mark, and encoding specification.
--   
--   While simple properties like <a>mark</a> may be provided directly, it
--   is usually clearer to label more complex ones such as encodings as
--   separate expressions. This becomes increasingly helpful for
--   visualizations that involve composition of layers, repeats and facets.
--   
--   Specifications can be built up by chaining a series of functions (such
--   as <a>dataColumn</a> or <a>position</a> in the example below).
--   Functional composition using the <a>.</a> operator allows this to be
--   done compactly.
--   
--   <pre>
--   let dat = dataFromColumns []
--             . dataColumn "a" (Strings [ "C", "C", "D", "D", "E", "E" ])
--             . dataColumn "b" (Numbers [ 2, 7, 1, 2, 6, 8 ])
--   
--       enc = encoding
--             . position X [ PName "a", PmType Nominal ]
--             . position Y [ PName "b", PmType Quantitative, PAggregate Mean ]
--   
--   in toVegaLite [ dat [], mark Bar [], enc [] ]
--   </pre>
toVegaLite :: [(VLProperty, VLSpec)] -> VegaLite

-- | Extract the specification for passing to a VegaLite visualizer.
--   
--   <pre>
--   let vlSpec = fromVL vl
--   Data.ByteString.Lazy.Char8.putStrLn (Data.Aeson.Encode.Pretty.encodePretty vlSpec)
--   </pre>
--   
--   Note that there is <b>no</b> validation done to ensure that the output
--   matches the Vega Lite schema. That is, it is possible to create an
--   invalid visualization with this module (e.g. missing a data source or
--   referring to an undefined field).
fromVL :: VegaLite -> VLSpec

-- | Top-level Vega-Lite properties. These are the ones that define the
--   core of the visualization grammar. All properties are created by
--   functions which can be arranged into seven broad groups:
--   
--   <ul>
--   <li><i>Data Properties</i> These relate to the input data to be
--   visualized. Generated by <a>dataFromColumns</a>, <a>dataFromRows</a>,
--   <a>dataFromUrl</a>, <a>dataFromSource</a> and
--   <a>dataFromJson</a>.</li>
--   <li><i>Transform Properties</i> These indicate that some
--   transformation of input data should be applied before encoding them
--   visually. Generated by <a>transform</a> and <a>projection</a> they can
--   include data transformations such as <a>filter</a>, <a>binAs</a> and
--   <a>calculateAs</a> and geo transformations of longitude, latitude
--   coordinates used by marks such as <a>Geoshape</a>, <a>Point</a>, and
--   <a>Line</a>.</li>
--   <li><i>Mark Properties</i> These relate to the symbols used to
--   visualize data items. They are generated by <a>mark</a>, and include
--   types such as <a>Circle</a>, <a>Bar</a>, and <a>Line</a>.</li>
--   <li><i>Encoding Properties</i> These specify which data elements are
--   mapped to which mark characteristics (known as <i>channels</i>).
--   Generated by <a>encoding</a>, they include encodings such as
--   <a>position</a>, <a>color</a>, <a>size</a>, <a>shape</a>, <a>text</a>
--   and <a>hyperlink</a>.</li>
--   <li><i>Composition Properties</i> These allow visualization views to
--   be combined to form more complex visualizations. Generated by
--   <a>layer</a>, <a>repeat</a>, <a>facet</a>, <a>hConcat</a>,
--   <a>vConcat</a>, <tt>spec</tt>, and <a>resolve</a>.</li>
--   <li><i>Interaction Properties</i> These allow interactions such as
--   clicking, dragging and others generated via a GUI or data stream to
--   influence the visualization. Generated by <a>selection</a>.</li>
--   <li><i>Supplementary and Configuration Properties</i> These provide a
--   means to add metadata and styling to one or more visualizations.
--   Generated by <a>name</a>, <a>title</a>, <a>description</a>,
--   <a>background</a>, <a>height</a>, <a>width</a>, <a>padding</a>,
--   <a>autosize</a>, and <a>configure</a>.</li>
--   </ul>
data VLProperty

-- | The specification is represented as JSON.
type VLSpec = Value

-- | A Vega Lite visualization, created by <a>toVegaLite</a>. The contents
--   can be extracted with <a>fromVL</a>.
data VegaLite

-- | Represents a named Vega-Lite specification, usually generated by a
--   function in this module. You shouldn't need to create
--   <tt>LabelledSpec</tt> tuples directly, but they can be useful for type
--   annotations.
type LabelledSpec = (Text, VLSpec)

-- | Represent those functions which can be chained together using function
--   composition to append new specifications onto an existing list.
type BuildLabelledSpecs = [LabelledSpec] -> [LabelledSpec]

-- | Combines a list of labelled specifications into a single
--   specification. This is useful when you wish to create a single page
--   with multiple visulizualizations.
--   
--   <pre>
--   combineSpecs
--       [ ( "vis1", myFirstVis )
--       , ( "vis2", mySecondVis )
--       , ( "vis3", myOtherVis )
--       ]
--   </pre>
combineSpecs :: [LabelledSpec] -> VLSpec

-- | Declare data source from a url. The url can be a local path on a web
--   server or an external http(s) url. Used to create a data ( property,
--   specification ) pair. An optional list of field formatting
--   instructions can be provided as the second parameter or an empty list
--   to use the default formatting. See the <a>Vega-Lite documentation</a>
--   for details.
--   
--   <pre>
--   toVegaLite
--       [ dataFromUrl "data/weather.csv" [ Parse [ ( "date", FoDate "%Y-%m-%d %H:%M" ) ] ]
--       , mark Line []
--       , enc []
--       ]
--   </pre>
dataFromUrl :: Text -> [Format] -> Data

-- | Declare a data source from a provided list of column values. Each
--   column contains values of the same type, but columns each with a
--   different type are permitted. Columns should all contain the same
--   number of items; if not the dataset will be truncated to the length of
--   the shortest column. An optional list of field formatting instructions
--   can be provided as the first parameter or an empty list to use the
--   default formatting. See the <a>Vega-Lite documentation</a> for
--   details. The columns themselves are most easily generated with
--   <a>dataColumn</a>
--   
--   <pre>
--   data =
--       dataFromColumns [ Parse [ ( "Year", FoDate "%Y" ) ] ]
--           . dataColumn "Animal" (Strings [ "Fish", "Dog", "Cat" ])
--           . dataColumn "Age" (Numbers [ 28, 12, 6 ])
--           . dataColumn "Year" (Strings [ "2010", "2014", "2015" ])
--   </pre>
dataFromColumns :: [Format] -> [DataColumn] -> Data

-- | Declare a data source from a provided list of row values. Each row
--   contains a list of tuples where the first value is a string
--   representing the column name, and the second the column value for that
--   row. Each column can have a value of a different type but you must
--   ensure that when subsequent rows are added, they match the types of
--   previous values with shared column names. An optional list of field
--   formatting instructions can be provided as the first parameter or an
--   empty list to use the default formatting. See the <a>Vega-Lite
--   documentation</a> for details.
--   
--   The rows themselves are most easily generated with <a>dataRow</a>.
--   Note though that generally if you are creating data inline (as opposed
--   to reading from a file), adding data by column is more efficient and
--   less error-prone.
--   
--   <pre>
--   data = dataFromRows [ Parse [ ( "Year", FoDate "%Y" ) ] ]
--           . dataRow [ ( "Animal", Str "Fish" ), ( "Age", Number 28 ), ( "Year", Str "2010" ) ]
--           . dataRow [ ( "Animal", Str "Dog" ), ( "Age", Number 12 ), ( "Year", Str "2014" ) ]
--           . dataRow [ ( "Animal", Str "Cat" ), ( "Age", Number 6 ), ( "Year", Str "2015" ) ]
--   </pre>
dataFromRows :: [Format] -> [DataRow] -> Data

-- | Declare a data source from a provided json specification. The most
--   likely use-case for specifying json inline is when creating
--   <a>geojson</a> objects, when <a>geometry</a>,
--   <a>geometryCollection</a>, and <a>geoFeatureCollection</a> functions
--   may be used. For more general cases of json creation, consider
--   <a>encode</a>.
--   
--   <pre>
--   let geojson =
--           geometry (GeoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
--   in toVegaLite
--       [ width 200
--       , height 200
--       , dataFromJson geojson []
--       , projection [ PType Orthographic ]
--       , mark Geoshape []
--       ]
--   </pre>
dataFromJson :: VLSpec -> [Format] -> Data

-- | Declare data from a named source. The source may be from named
--   <a>datasets</a> within a specification or a named data source created
--   via the <a>Vega View API</a>. An optional list of field formatting
--   instructions can be provided as the second parameter or an empty list
--   to use the default formatting. See the <a>Vega-Lite documentation</a>
--   for details.
--   
--   <pre>
--   toVegaLite
--       [ datasets [ ( "myData", data [] ),  ( "myJson", dataFromJson json [] ) ]
--       , dataFromSource "myData" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
dataFromSource :: Text -> [Format] -> Data

-- | Create a dataset comprising a collection of named <a>Data</a> items.
--   Each data item can be created with normal data generating functions
--   such as <a>dataFromRows</a> or <a>dataFromJson</a>. These can be later
--   referred to using <a>dataFromSource</a>.
--   
--   <pre>
--   let toJS = Data.Aeson.toJSON
--       obj = Data.Aeson.object
--   
--       data = dataFromRows []
--               . dataRow [ ( "cat", Str "a" ), ( "val", Number 10 ) ]
--               . dataRow [ ( "cat", Str "b" ), ( "val", Number 18 ) ]
--       json = toJS
--               [ obj [ ( "cat", toJS "a" ), ( "val", toJS 120 ) ]
--               , obj [ ( "cat", toJS "b" ), ( "val", toJS 180 ) ]
--               ]
--   
--       enc = ...
--   
--   in toVegaLite
--       [ datasets [ ( "myData", data [] ),  ( "myJson", dataFromJson json [] ) ]
--       , dataFromSource "myData" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
datasets :: [(Text, Data)] -> Data

-- | Create a column of data. A column has a name and a list of values. The
--   final parameter is the list of any other columns to which this is
--   added.
--   
--   <pre>
--   dataColumn "Animal" (Strings [ "Cat", "Dog", "Mouse"]) []
--   </pre>
dataColumn :: Text -> DataValues -> [DataColumn] -> [DataColumn]

-- | Create a row of data. A row comprises a list of (columnName, value)
--   pairs. The final parameter is the list of any other rows to which this
--   is added.
--   
--   <pre>
--   dataRow [("Animal", Str "Fish"), ("Age",Number 28), ("Year", Str "2010")] []
--   </pre>
dataRow :: [(Text, DataValue)] -> [DataRow] -> [DataRow]

-- | Specifies a geometric object to be used in a geoShape specification.
--   The first parameter is the geometric type, the second an optional list
--   of properties to be associated with the object.
--   
--   <pre>
--   geojson =
--       geometry (GeoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
--   </pre>
geometry :: Geometry -> [(Text, DataValue)] -> VLSpec

-- | Specifies a list of geo features to be used in a geoShape
--   specification. Each feature object in this collection can be created
--   with the <a>geometry</a> function.
--   
--   <pre>
--   geojson =
--       geoFeatureCollection
--           [ geometry (GeoPolygon [ [ ( -3, 59 ), ( -3, 52 ), ( 4, 52 ), ( -3, 59 ) ] ])
--               [ ( "myRegionName", Str "Northern region" ) ]
--           , geometry (GeoPolygon [ [ ( -3, 52 ), ( 4, 52 ), ( 4, 45 ), ( -3, 52 ) ] ])
--               [ ( "myRegionName", Str "Southern region" ) ]
--           ]
--   </pre>
geoFeatureCollection :: [VLSpec] -> VLSpec

-- | Specifies a list of geometry objects to be used in a geoShape
--   specification. Each geometry object in this collection can be created
--   with the <a>geometry</a> function.
--   
--   <pre>
--   geojson =
--       geometryCollection
--           [ geometry (GeoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []
--           , geometry (GeoPoint -3.5 55.5) []
--           ]
--   </pre>
geometryCollection :: [VLSpec] -> VLSpec

-- | Convenience type annotation label for use with data generation
--   functions.
--   
--   <pre>
--   myRegion : [DataColumn] -&gt; Data
--   myRegion =
--       dataFromColumns []
--           . dataColumn "easting" (Numbers [ -3, 4, 4, -3, -3 ])
--           . dataColumn "northing" (Numbers [ 52, 52, 45, 45, 52 ])
--   </pre>
type Data = (VLProperty, VLSpec)

-- | Represents a single column of data. Used when generating inline data
--   with <a>dataColumn</a>.
type DataColumn = [LabelledSpec]

-- | Represents a single row of data. Used when generating inline data with
--   <a>dataRow</a>.
type DataRow = VLSpec

-- | Specifies the type of format a data source uses. If the format is
--   indicated by the file name extension (<tt>".tsv"</tt>,
--   <tt>".csv"</tt>, <tt>".json"</tt>) there is no need to indicate the
--   format explicitly. However this can be useful if the filename
--   extension does not indicate type (e.g. <tt>".txt"</tt>) or you wish to
--   customise the parsing of a file. For example, when specifying the
--   <tt>JSON</tt> format, its parameter indicates the name of property
--   field containing the attribute data to extract. For details see the
--   <a>Vega-Lite documentation</a>.
data Format
JSON :: Text -> Format
CSV :: Format
TSV :: Format
TopojsonFeature :: Text -> Format
TopojsonMesh :: Text -> Format
Parse :: [(Text, DataType)] -> Format

-- | Specifies the type and content of geometry specifications for
--   programatically creating GeoShapes. These can be mapped to the
--   <a>GeoJson geometry object types</a> where the pluralised type names
--   refer to their <tt>Multi</tt> prefixed equivalent in the GeoJSON
--   specification.
data Geometry
GeoPoint :: Double -> Double -> Geometry
GeoPoints :: [(Double, Double)] -> Geometry
GeoLine :: [(Double, Double)] -> Geometry
GeoLines :: [[(Double, Double)]] -> Geometry
GeoPolygon :: [[(Double, Double)]] -> Geometry
GeoPolygons :: [[[(Double, Double)]]] -> Geometry

-- | Indicates the type of data to be parsed when reading input data. For
--   <tt>FoDate</tt> and <tt>FoUtc</tt>, the formatting specification can
--   be specified using <a>D3's formatting specifiers</a> or left as an
--   empty string if default date formatting is to be applied. Care should
--   be taken when assuming default parsing of dates because different
--   browsers can parse dates differently. Being explicit about the date
--   format is usually safer.
data DataType
FoNumber :: DataType
FoBoolean :: DataType
FoDate :: Text -> DataType
FoUtc :: Text -> DataType

-- | Create a single transform from a list of transformation
--   specifications. Note that the order of transformations can be
--   important, especially if labels created with <a>calculateAs</a>,
--   <a>timeUnitAs</a>, and <a>binAs</a> 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.
--   
--   <pre>
--   trans = transform
--           . filter (FExpr "datum.year == 2010")
--           . calculateAs "datum.sex == 2 ? <tt>Female</tt> : <tt>Male</tt>" "gender"
--   </pre>
transform :: [LabelledSpec] -> (VLProperty, VLSpec)

-- | Sets the cartographic projection used for geospatial coordinates. A
--   projection defines the mapping from <tt>(longitude,latitude)</tt> to
--   an <tt>(x,y)</tt> plane used for rendering. This is useful when using
--   the <a>Geoshape</a> mark. For further details see the <a>Vega-Lite
--   documentation</a>.
--   
--   <pre>
--   proj = projection [ PType Orthographic, PRotate (-40) 0 0 ]
--   </pre>
projection :: [ProjectionProperty] -> (VLProperty, VLSpec)

-- | Properties for customising a geospatial projection that converts
--   longitude,latitude pairs into planar (x,y) coordinate pairs for
--   rendering and query. For details see the <a>Vega-Lite
--   documentation</a>.
data ProjectionProperty
PType :: Projection -> ProjectionProperty
PClipAngle :: Maybe Double -> ProjectionProperty
PClipExtent :: ClipRect -> ProjectionProperty
PCenter :: Double -> Double -> ProjectionProperty
PRotate :: Double -> Double -> Double -> ProjectionProperty
PPrecision :: Double -> ProjectionProperty
PCoefficient :: Double -> ProjectionProperty
PDistance :: Double -> ProjectionProperty
PFraction :: Double -> ProjectionProperty
PLobes :: Int -> ProjectionProperty
PParallel :: Double -> ProjectionProperty
PRadius :: Double -> ProjectionProperty
PRatio :: Double -> ProjectionProperty
PSpacing :: Double -> ProjectionProperty
PTilt :: Double -> ProjectionProperty

-- | Types of geographic map projection. These are based on a subset of
--   those provided by the <a>d3-geo library</a>. For details of available
--   projections see the <a>Vega-Lite documentation</a>.
data Projection
Albers :: Projection
AlbersUsa :: Projection
AzimuthalEqualArea :: Projection
AzimuthalEquidistant :: Projection
ConicConformal :: Projection
ConicEqualArea :: Projection
ConicEquidistant :: Projection

-- | Specify the name of the custom D3 prohection to use. See the <a>Vega
--   API</a> for more information.
Custom :: Text -> Projection
Equirectangular :: Projection
Gnomonic :: Projection
Mercator :: Projection
Orthographic :: Projection
Stereographic :: Projection
TransverseMercator :: Projection

-- | Specifies a clipping rectangle in pixel units for defining the clip
--   extent of a map projection.
data ClipRect
NoClip :: ClipRect

-- | The left, top, right, and bottom extents.
LTRB :: Double -> Double -> Double -> Double -> ClipRect

-- | Defines a set of named aggregation transformations to be used when
--   encoding channels. This is useful when, for example, you wish to apply
--   the same transformation to a number of channels but do not want to
--   define it each time. For further details see the <a>Vega-Lite
--   documentation</a>.
--   
--   <pre>
--   trans =
--       transform
--           . aggregate
--               [ opAs Min "people" "lowerBound", opAs Max "people" "upperBound" ]
--               [ "age" ]
--   </pre>
aggregate :: [VLSpec] -> [Text] -> BuildLabelledSpecs

-- | Type of aggregation operation. See the <a>Vega-Lite documentation</a>
--   for more details.
data Operation
ArgMax :: Operation
ArgMin :: Operation
Average :: Operation
CI0 :: Operation
CI1 :: Operation
Count :: Operation
Distinct :: Operation
Max :: Operation
Mean :: Operation
Median :: Operation
Min :: Operation
Missing :: Operation
Q1 :: Operation
Q3 :: Operation
Stderr :: Operation
Stdev :: Operation
StdevP :: Operation
Sum :: Operation
Valid :: Operation
Variance :: Operation
VarianceP :: Operation

-- | Create a named aggregation operation on a field that can be added to a
--   transformation. For further details see the <a>Vega-Lite
--   documentation</a>.
--   
--   <pre>
--   trans =
--       transform
--           . aggregate
--               [ opAs Min "people" "lowerBound"
--               , opAs Max "people" "upperBound"
--               ]
--               [ "age" ]
--   </pre>
opAs :: Operation -> Text -> Text -> VLSpec

-- | Creates a new data field based on the given temporal binning. Unlike
--   the direct encoding binning, this transformation is named and so can
--   be referred to in multiple encodings. Note though that usually it is
--   easer to apply the temporal binning directly as part of the encoding
--   as this will automatically format the temporal axis. See the
--   <a>Vega-Lite documentation</a> for further details.
--   
--   The following example takes a temporal dataset and encodes daily
--   totals from it grouping by month:
--   
--   <pre>
--   trans = transform . timeUnitAs Month "date" "monthly"
--   
--   enc = encoding
--           . position X [ PName "date", PmType Temporal, PTimeUnit Day ]
--           . position Y [ PAggregate Sum, PmType Quantitative ]
--           . detail [ DName "monthly", DmType Temporal ]
--   </pre>
timeUnitAs :: TimeUnit -> Text -> Text -> BuildLabelledSpecs

-- | Create a named binning transformation that may be referenced in other
--   Transformations or encodings. See the <a>Vega-Lite documentation</a>
--   for more details. Note that usually, direct binning within an encoding
--   is preferred over this form of bin transformation.
--   
--   <pre>
--   trans =
--       transform
--           . binAs [ MaxBins 3 ] "IMDB_Rating" "ratingGroup"
--   </pre>
binAs :: [BinProperty] -> Text -> Text -> BuildLabelledSpecs

-- | Type of binning property to customise. See the <a>Vega-Lite
--   documentation</a> for more details.
data BinProperty
Base :: Double -> BinProperty
Divide :: Double -> Double -> BinProperty
Extent :: Double -> Double -> BinProperty
MaxBins :: Int -> BinProperty
MinStep :: Double -> BinProperty
Nice :: Bool -> BinProperty
Step :: Double -> BinProperty
Steps :: [Double] -> BinProperty

-- | Creates a new data field based on calculations from existing fields.
--   See the <a>Vega-Lite documentation</a> for further details.
--   
--   <pre>
--   trans =
--       transform . calculateAs "datum.sex == 2 ? <tt>F</tt> : <tt>M</tt>" "gender"
--   </pre>
calculateAs :: Text -> Text -> BuildLabelledSpecs

-- | Adds the given filter operation a list of transformations that may be
--   applied to a channel or field. The first parameter is the filter
--   operation and the second, often implicit, parameter is the list of
--   other filter operations to which this should be added in sequence.
--   
--   <pre>
--   trans =
--       transform
--           . filter (FEqual "Animal" (Str "Cat"))
--   </pre>
--   
--   Filter operations can combine selections and data predicates with
--   <a>BooleanOp</a> expressions:
--   
--   <pre>
--   trans =
--       transform
--           . filter (FCompose (And (Expr "datum.Weight_in_lbs &gt; 3000") (Selection "brush")))
--   </pre>
filter :: Filter -> BuildLabelledSpecs

-- | Type of filtering operation. See the <a>Vega-Lite documentation</a>
--   for details.
data Filter
FEqual :: Text -> DataValue -> Filter
FExpr :: Text -> Filter
FCompose :: BooleanOp -> Filter
FSelection :: Text -> Filter
FOneOf :: Text -> DataValues -> Filter
FRange :: Text -> FilterRange -> Filter

-- | A pair of filter range data values. The first argument is the
--   inclusive minimum vale to accept and the second the inclusive maximum.
data FilterRange
NumberRange :: Double -> Double -> FilterRange
DateRange :: [DateTime] -> [DateTime] -> FilterRange

-- | Perform a lookup of named fields between two data sources. This allows
--   you to find values in one data source based on the values in another
--   (like a relational join).
--   
--   Unlike <a>lookupAs</a>, this function will only return the specific
--   fields named in the fourth parameter. If you wish to return the entire
--   set of fields in the secondary data source as a single object, use
--   <a>lookupAs</a>.
--   
--   See the <a>Vega-Lite documentation</a> for further details.
--   
--   The following would return the values in the <tt>age</tt> and
--   <tt>height</tt> fields from <tt>lookup_people.csv</tt> for all rows
--   where the value in the <tt>name</tt> column in that file matches the
--   value of <tt>person</tt> in the primary data source.
--   
--   <pre>
--   trans =
--       transform
--           . lookup "person" (dataFromUrl "data/lookup_people.csv" []) "name" [ "age", "height" ]
--   </pre>
lookup :: Text -> Data -> Text -> [Text] -> BuildLabelledSpecs

-- | Perform an object lookup between two data sources. This allows you to
--   find values in one data source based on the values in another (like a
--   relational join).
--   
--   Unlike <a>lookup</a>, this function returns the entire set of field
--   values from the secondary data source when keys match. Those fields
--   are stored as an object with the name provided in the fourth
--   parameter.
--   
--   See the <a>Vega-Lite documentation</a> for further details.
--   
--   In the following example, <tt>personDetails</tt> would reference all
--   the field values in <tt>lookup_people.csv</tt> for each row where the
--   value in the <tt>name</tt> column in that file matches the value of
--   <tt>person</tt> in the primary data source.
--   
--   <pre>
--   trans = transform
--           . lookupAs "person" (dataFromUrl "data/lookup_people.csv" []) "name" "personDetails"
--   </pre>
lookupAs :: Text -> Data -> Text -> Text -> BuildLabelledSpecs

-- | Create a mark specification. All marks must have a type (first
--   parameter) and can optionally be customised with a list of mark
--   properties such as interpolation style for lines. To keep the default
--   style for the mark, just provide an empty list for the second
--   parameter.
--   
--   <pre>
--   mark Circle []
--   mark Line [ MInterpolate StepAfter ]
--   </pre>
mark :: Mark -> [MarkProperty] -> (VLProperty, VLSpec)

-- | Type of visual mark used to represent data in the visualization.
data Mark
Area :: Mark
Bar :: Mark
Circle :: Mark
Geoshape :: Mark
Line :: Mark
Point :: Mark
Rect :: Mark
Rule :: Mark
Square :: Mark
Text :: Mark
Tick :: Mark

-- | Properties for customising the appearance of a mark. For details see
--   the <a>Vega-Lite documentation</a>.
--   
--   Not all properties are valid for each mark type.
data MarkProperty
MAlign :: HAlign -> MarkProperty
MAngle :: Double -> MarkProperty
MBandSize :: Double -> MarkProperty
MBaseline :: VAlign -> MarkProperty
MBinSpacing :: Double -> MarkProperty
MClip :: Bool -> MarkProperty
MColor :: Text -> MarkProperty
MCursor :: Cursor -> MarkProperty
MContinuousBandSize :: Double -> MarkProperty
MDiscreteBandSize :: Double -> MarkProperty
MdX :: Double -> MarkProperty
MdY :: Double -> MarkProperty
MFill :: Text -> MarkProperty
MFilled :: Bool -> MarkProperty
MFillOpacity :: Double -> MarkProperty
MFont :: Text -> MarkProperty
MFontSize :: Double -> MarkProperty
MFontStyle :: Text -> MarkProperty
MFontWeight :: FontWeight -> MarkProperty
MInterpolate :: MarkInterpolation -> MarkProperty
MOpacity :: Double -> MarkProperty
MOrient :: MarkOrientation -> MarkProperty
MRadius :: Double -> MarkProperty
MShape :: Symbol -> MarkProperty
MShortTimeLabels :: Bool -> MarkProperty
MSize :: Double -> MarkProperty
MStroke :: Text -> MarkProperty
MStrokeDash :: [Double] -> MarkProperty
MStrokeDashOffset :: Double -> MarkProperty
MStrokeOpacity :: Double -> MarkProperty
MStrokeWidth :: Double -> MarkProperty
MStyle :: [Text] -> MarkProperty
MTension :: Double -> MarkProperty
MText :: Text -> MarkProperty
MTheta :: Double -> MarkProperty
MThickness :: Double -> MarkProperty

-- | Indicates desired orientation of a mark (e.g. horizontally or
--   vertically oriented bars).
data MarkOrientation
Horizontal :: MarkOrientation
Vertical :: MarkOrientation

-- | Indicates mark interpolation style. See the <a>Vega-Lite
--   documentation</a> for details.
data MarkInterpolation
Basis :: MarkInterpolation
BasisClosed :: MarkInterpolation
BasisOpen :: MarkInterpolation
Bundle :: MarkInterpolation
Cardinal :: MarkInterpolation
CardinalClosed :: MarkInterpolation
CardinalOpen :: MarkInterpolation
Linear :: MarkInterpolation
LinearClosed :: MarkInterpolation
Monotone :: MarkInterpolation
StepAfter :: MarkInterpolation
StepBefore :: MarkInterpolation
Stepwise :: MarkInterpolation

-- | Identifies the type of symbol.
data Symbol
SymCircle :: Symbol
SymSquare :: Symbol
Cross :: Symbol
Diamond :: Symbol
TriangleUp :: Symbol
TriangleDown :: Symbol

-- | Define a custom shape with a SVG path description.
Path :: Text -> Symbol

-- | Represents the type of cursor to display. For an explanation of each
--   type, see the <a>CSS documentation</a>.
data Cursor
CAuto :: Cursor
CDefault :: Cursor
CNone :: Cursor
CContextMenu :: Cursor
CHelp :: Cursor
CPointer :: Cursor
CProgress :: Cursor
CWait :: Cursor
CCell :: Cursor
CCrosshair :: Cursor
CText :: Cursor
CVerticalText :: Cursor
CAlias :: Cursor
CCopy :: Cursor
CMove :: Cursor
CNoDrop :: Cursor
CNotAllowed :: Cursor
CAllScroll :: Cursor
CColResize :: Cursor
CRowResize :: Cursor
CNResize :: Cursor
CEResize :: Cursor
CSResize :: Cursor
CWResize :: Cursor
CNEResize :: Cursor
CNWResize :: Cursor
CSEResize :: Cursor
CSWResize :: Cursor
CEWResize :: Cursor
CNSResize :: Cursor
CNESWResize :: Cursor
CNWSEResize :: Cursor
CZoomIn :: Cursor
CZoomOut :: Cursor
CGrab :: Cursor
CGrabbing :: Cursor

-- | Create an encoding specification from a list of channel encodings.
--   
--   <pre>
--   enc = encoding
--           . position X [ PName "Animal", PmType Ordinal ]
--           . position Y [ PName "Age", PmType Quantitative ]
--           . shape [ MName "Species", MmType Nominal ]
--           . size [ MName "Population", MmType Quantitative ]
--   </pre>
encoding :: [LabelledSpec] -> (VLProperty, VLSpec)

-- | Type of measurement to be associated with some channel.
data Measurement

-- | Data are categories identified by name alone and which have no
--   intrinsic order.
Nominal :: Measurement

-- | Data are also categories, but ones which have some natural order.
Ordinal :: Measurement

-- | Data are numeric measurements typically on a continuous scale.
Quantitative :: Measurement

-- | Data represents time in some manner.
Temporal :: Measurement

-- | Geospatial position encoding (<a>Longitude</a> and <a>Latitude</a>)
--   should specify the <a>PmType</a> as <tt>Quantitative</tt>.
--   Geographically referenced features encoded as <a>shape</a> marks
--   should specify <a>MmType</a> as <tt>GeoFeature</tt> (Vega-Lite
--   currently refers to this type as <tt><a>geojson</a></tt>.
GeoFeature :: Measurement

-- | Encode a position channel.
--   
--   <pre>
--   enc =
--       encoding
--         . position X [ PName "Animal", PmType Ordinal ]
--   </pre>
--   
--   Encoding by position will generate an axis by default. To prevent the
--   axis from appearing, simply provide an empty list of axis properties
--   to <a>PAxis</a>:
--   
--   <pre>
--   enc =
--       encoding
--         . position X [ PName "Animal", PmType Ordinal, PAxis [] ]
--   </pre>
position :: Position -> [PositionChannel] -> BuildLabelledSpecs

-- | Position channel properties used for creating a position channel
--   encoding.
data PositionChannel
PName :: Text -> PositionChannel
PRepeat :: Arrangement -> PositionChannel
PmType :: Measurement -> PositionChannel
PBin :: [BinProperty] -> PositionChannel
PTimeUnit :: TimeUnit -> PositionChannel
PAggregate :: Operation -> PositionChannel
PScale :: [ScaleProperty] -> PositionChannel
PAxis :: [AxisProperty] -> PositionChannel
PSort :: [SortProperty] -> PositionChannel
PStack :: StackProperty -> PositionChannel

-- | Type of position channel, <tt>X</tt> and <tt>Y</tt> represent
--   horizontal and vertical axis dimensions on a plane and <tt>X2</tt> and
--   <tt>Y2</tt> represent secondary axis dimensions where two scales are
--   overlaid in the same space. Geographic positions represented by
--   longitude and latiutude values are identified with <tt>Longitude</tt>,
--   <tt>Latitude</tt> and their respective secondary equivalents. Such
--   geographic position channels are subject to a map projection (set
--   using <a>projection</a>) before being placed graphically.
data Position
X :: Position
Y :: Position
X2 :: Position
Y2 :: Position
Longitude :: Position
Latitude :: Position
Longitude2 :: Position
Latitude2 :: Position

-- | Allow type of sorting to be customised. For details see the
--   <a>Vega-Lite documentation</a>.
data SortProperty
Ascending :: SortProperty
Descending :: SortProperty
Op :: Operation -> SortProperty
ByField :: Text -> SortProperty
ByRepeat :: Arrangement -> SortProperty

-- | Describes the type of stacking to apply to a bar chart.
data StackProperty
StZero :: StackProperty
StNormalize :: StackProperty
StCenter :: StackProperty
NoStack :: StackProperty

-- | Axis customisation properties. These are used for customising
--   individual axes. To configure all axes, use <a>AxisConfig</a> with a
--   <a>configuration</a> instead. See the <a>Vega-Lite documentation</a>
--   for more details.
data AxisProperty
AxDomain :: Bool -> AxisProperty
AxFormat :: Text -> AxisProperty
AxGrid :: Bool -> AxisProperty
AxLabelAngle :: Double -> AxisProperty
AxLabelOverlap :: OverlapStrategy -> AxisProperty
AxLabelPadding :: Double -> AxisProperty
AxLabels :: Bool -> AxisProperty
AxMaxExtent :: Double -> AxisProperty
AxMinExtent :: Double -> AxisProperty
AxOffset :: Double -> AxisProperty
AxOrient :: Side -> AxisProperty
AxPosition :: Double -> AxisProperty
AxTicks :: Bool -> AxisProperty
AxTickCount :: Int -> AxisProperty
AxTickSize :: Double -> AxisProperty
AxTitle :: Text -> AxisProperty
AxTitleAlign :: HAlign -> AxisProperty
AxTitleAngle :: Double -> AxisProperty
AxTitleMaxLength :: Double -> AxisProperty
AxTitlePadding :: Double -> AxisProperty
AxValues :: [Double] -> AxisProperty
AxDates :: [[DateTime]] -> AxisProperty
AxZIndex :: Int -> AxisProperty

-- | Type of overlap strategy to be applied when there is not space to show
--   all items on an axis. See the <a>Vega-Lite documentation</a> for more
--   details.
data OverlapStrategy
ONone :: OverlapStrategy
OParity :: OverlapStrategy
OGreedy :: OverlapStrategy

-- | Represents one side of a rectangular space.
data Side
STop :: Side
SBottom :: Side
SLeft :: Side
SRight :: Side

-- | Indicates the horizontal alignment of text such as on an axis or
--   legend.
data HAlign
AlignCenter :: HAlign
AlignLeft :: HAlign
AlignRight :: HAlign

-- | Indicates the vertical alignment of text that may be attached to a
--   mark.
data VAlign
AlignTop :: VAlign
AlignMiddle :: VAlign
AlignBottom :: VAlign

-- | Indicates the weight options for a font.
data FontWeight
Bold :: FontWeight
Bolder :: FontWeight
Lighter :: FontWeight
Normal :: FontWeight
W100 :: FontWeight
W200 :: FontWeight
W300 :: FontWeight
W400 :: FontWeight
W500 :: FontWeight
W600 :: FontWeight
W700 :: FontWeight
W800 :: FontWeight
W900 :: FontWeight

-- | Describes a unit of time. Useful for encoding and transformations. See
--   the <a>Vega-Lite documentation</a> for further details.
--   
--   <pre>
--   encoding
--       . position X [ PName "date", PmType Temporal, PTimeUnit (Utc YearMonthDateHours) ]
--   </pre>
data TimeUnit
Year :: TimeUnit
YearQuarter :: TimeUnit
YearQuarterMonth :: TimeUnit
YearMonth :: TimeUnit
YearMonthDate :: TimeUnit
YearMonthDateHours :: TimeUnit
YearMonthDateHoursMinutes :: TimeUnit
YearMonthDateHoursMinutesSeconds :: TimeUnit
Quarter :: TimeUnit
QuarterMonth :: TimeUnit
Month :: TimeUnit
MonthDate :: TimeUnit
Date :: TimeUnit
Day :: TimeUnit
Hours :: TimeUnit
HoursMinutes :: TimeUnit
HoursMinutesSeconds :: TimeUnit
Minutes :: TimeUnit
MinutesSeconds :: TimeUnit
Seconds :: TimeUnit
SecondsMilliseconds :: TimeUnit
Milliseconds :: TimeUnit

-- | Encode a time as UTC (coordinated universal time, independent of local
--   time zones or daylight saving).
Utc :: TimeUnit -> TimeUnit

-- | Encode a size channel.
--   
--   <pre>
--   size [ MName "Age", MmType Quantitative ] []
--   </pre>
size :: [MarkChannel] -> BuildLabelledSpecs

-- | Encode a color channel.
--   
--   <pre>
--   color [ MName "Species", MmType Nominal ] []
--   </pre>
--   
--   Encoding a color channel will generate a legend by default. To stop
--   the legend appearing, just supply an empty list of legend properties
--   to <a>MLegend</a>:
--   
--   <pre>
--   color [ MName "Species", MmType Nominal, MLegend [] ] []
--   </pre>
color :: [MarkChannel] -> BuildLabelledSpecs

-- | Encode a fill channel. This acts in a similar way to encoding by
--   <a>color</a> but only affects the interior of closed shapes. The first
--   parameter is a list of mark channel properties that characterise the
--   way a data field is encoded by fill. The second parameter is a list of
--   any previous channels to which this fill channel should be added.
--   
--   <pre>
--   fill [ MName "Species", MmType Nominal ] []
--   </pre>
--   
--   Note that if both <tt>fill</tt> and <a>color</a> encodings are
--   specified, <tt>fill</tt> takes precedence.
fill :: [MarkChannel] -> BuildLabelledSpecs

-- | Encode a stroke channel. This acts in a similar way to encoding by
--   <a>color</a> but only affects the exterior boundary of marks.
--   
--   <pre>
--   stroke [ MName "Species", MmType Nominal ] []
--   </pre>
--   
--   Note that if both <tt>stroke</tt> and <a>color</a> encodings are
--   specified, <tt>stroke</tt> takes precedence.
stroke :: [MarkChannel] -> BuildLabelledSpecs

-- | Encode an opacity channel. The first parameter is a list of mark
--   channel properties that characterise the way a data field is encoded
--   by opacity. The second parameter is a list of any previous channels to
--   which this opacity channel should be added.
--   
--   <pre>
--   opacity [ MName "Age", MmType Quantitative ] []
--   </pre>
opacity :: [MarkChannel] -> BuildLabelledSpecs

-- | Encode a shape channel.
--   
--   <pre>
--   shape [ MName "Species", MmType Nominal ] []
--   </pre>
shape :: [MarkChannel] -> BuildLabelledSpecs

-- | Mark channel properties used for creating a mark channel encoding.
data MarkChannel
MName :: Text -> MarkChannel
MRepeat :: Arrangement -> MarkChannel
MmType :: Measurement -> MarkChannel

-- | Use an empty list to remove the scale.
MScale :: [ScaleProperty] -> MarkChannel
MBin :: [BinProperty] -> MarkChannel
MTimeUnit :: TimeUnit -> MarkChannel
MAggregate :: Operation -> MarkChannel

-- | Use an empty list to remove the legend.
MLegend :: [LegendProperty] -> MarkChannel
MSelectionCondition :: BooleanOp -> [MarkChannel] -> [MarkChannel] -> MarkChannel
MDataCondition :: BooleanOp -> [MarkChannel] -> [MarkChannel] -> MarkChannel
MPath :: Text -> MarkChannel
MNumber :: Double -> MarkChannel
MString :: Text -> MarkChannel
MBoolean :: Bool -> MarkChannel

-- | Legend properties. For more detail see the <a>Vega-Lite
--   documentation</a>.
data LegendProperty
LEntryPadding :: Double -> LegendProperty
LFormat :: Text -> LegendProperty
LOffset :: Double -> LegendProperty
LOrient :: LegendOrientation -> LegendProperty
LPadding :: Double -> LegendProperty
LTickCount :: Double -> LegendProperty
LTitle :: Text -> LegendProperty
LType :: Legend -> LegendProperty
LValues :: LegendValues -> LegendProperty
LZIndex :: Int -> LegendProperty

-- | Indicates the type of legend to create.
data Legend

-- | Typically used for continuous quantitative data.
Gradient :: Legend

-- | Typically used for categorical data.
Symbol :: Legend

-- | Indicates the legend orientation. See the <a>Vega-Lite
--   documentation</a> for more details.
data LegendOrientation
BottomLeft :: LegendOrientation
BottomRight :: LegendOrientation
Left :: LegendOrientation
None :: LegendOrientation
Right :: LegendOrientation
TopLeft :: LegendOrientation
TopRight :: LegendOrientation

-- | A list of data values suitable for setting legend values.
data LegendValues
LDateTimes :: [[DateTime]] -> LegendValues
LNumbers :: [Double] -> LegendValues
LStrings :: [Text] -> LegendValues

-- | Encode a text channel. See the <a>Vega-Lite documentation</a> for
--   further details on the text and tooltip channels and <a>Vega-Lite
--   formatting documentation</a> for formatting the appearance of the
--   text.
--   
--   <pre>
--   enc =
--       encoding
--           . position X [ PName "miles", PmType Quantitative ]
--           . position Y [ PName "gas", PmType Quantitative ]
--           . text [ TName "miles", TmType Quantitative ]
--   </pre>
text :: [TextChannel] -> BuildLabelledSpecs

-- | Encode a tooltip channel. See the <a>Vega-Lite documentation</a> for
--   further details on the text and tooltip channels and <a>Vega-Lite
--   formatting documentation</a> for formatting the appearance of the
--   text.
--   
--   <pre>
--   enc = encoding
--           . position X [ PName "Horsepower", PmType Quantitative ]
--           . position Y [ PName "Miles_per_Gallon", PmType Quantitative ]
--           . tooltip [ TName "Year", TmType Temporal, TFormat "%Y" ]
--   </pre>
tooltip :: [TextChannel] -> BuildLabelledSpecs

-- | Types of text channel property used for displaying text as part of the
--   visualization.
data TextChannel
TName :: Text -> TextChannel
TRepeat :: Arrangement -> TextChannel
TmType :: Measurement -> TextChannel
TBin :: [BinProperty] -> TextChannel
TAggregate :: Operation -> TextChannel
TTimeUnit :: TimeUnit -> TextChannel
TSelectionCondition :: BooleanOp -> [TextChannel] -> [TextChannel] -> TextChannel
TDataCondition :: BooleanOp -> [TextChannel] -> [TextChannel] -> TextChannel
TFormat :: Text -> TextChannel

-- | Encode a hyperlink channel. The first parameter is a list of hyperlink
--   channel properties that characterise the hyperlinking such as the
--   destination url and cursor type. The second parameter is a list of any
--   previous encoding channels to which this hyperlink channel should be
--   added.
--   
--   <pre>
--   hyperlink [ HName "Species", HmType Nominal ] []
--   </pre>
--   
--   For further details see the <a>Vega-Lite documentation</a>.
hyperlink :: [HyperlinkChannel] -> BuildLabelledSpecs

-- | Types of hyperlink channel property used for linking marks or text to
--   URLs.
data HyperlinkChannel
HName :: Text -> HyperlinkChannel
HRepeat :: Arrangement -> HyperlinkChannel
HmType :: Measurement -> HyperlinkChannel
HBin :: [BinProperty] -> HyperlinkChannel
HAggregate :: Operation -> HyperlinkChannel
HTimeUnit :: TimeUnit -> HyperlinkChannel
HSelectionCondition :: BooleanOp -> [HyperlinkChannel] -> [HyperlinkChannel] -> HyperlinkChannel
HDataCondition :: BooleanOp -> [HyperlinkChannel] -> [HyperlinkChannel] -> HyperlinkChannel
HString :: Text -> HyperlinkChannel

-- | Encode an order channel. The first parameter is a list of order field
--   definitions to define the channel. The second parameter is a list of
--   any previous channels to which this order channel is to be added.
--   
--   <pre>
--   enc =
--       encoding
--           . position X [ PName "miles", PmType Quantitative ]
--           . position Y [ PName "gas", PmType Quantitative ]
--           . order [ OName "year", OmType Temporal ]
--   </pre>
order :: [OrderChannel] -> BuildLabelledSpecs

-- | Properties of an ordering channel used for sorting data fields.
data OrderChannel
OName :: Text -> OrderChannel
ORepeat :: Arrangement -> OrderChannel
OmType :: Measurement -> OrderChannel
OBin :: [BinProperty] -> OrderChannel
OAggregate :: Operation -> OrderChannel
OTimeUnit :: TimeUnit -> OrderChannel
OSort :: [SortProperty] -> OrderChannel

-- | Encode a new facet to be arranged in rows.
--   
--   <pre>
--   enc =
--       encoding
--           . position X [ PName "people", PmType Quantitative ]
--           . position Y [ PName "gender", PmType Nominal ]
--           . row [ FName "age", FmType Ordinal ]
--   </pre>
row :: [FacetChannel] -> BuildLabelledSpecs

-- | Encodes a new facet to be arranged in columns.
--   
--   <pre>
--   enc =
--       encoding
--           . position X [ PName "people", PmType Quantitative ]
--           . position Y [ PName "gender", PmType Nominal ]
--           . column [ FName "age", FmType Ordinal ]
--   </pre>
column :: [FacetChannel] -> BuildLabelledSpecs

-- | Encode a "level of detail" channel. This provides a way of grouping by
--   a field but unlike, say <a>color</a>, all groups have the same visual
--   properties. The first parameter is a list of the field characteristics
--   to be grouped. The second parameter is a list of any previous channels
--   to which this detail channel should be added. See the <a>Vega-Lite
--   documentation</a> for details.
--   
--   <pre>
--   detail [ DName "Species", DmType Nominal ] []
--   </pre>
detail :: [DetailChannel] -> BuildLabelledSpecs

-- | Level of detail channel properties used for creating a grouped channel
--   encoding.
data DetailChannel
DName :: Text -> DetailChannel
DmType :: Measurement -> DetailChannel
DBin :: [BinProperty] -> DetailChannel
DTimeUnit :: TimeUnit -> DetailChannel
DAggregate :: Operation -> DetailChannel

-- | Individual scale property. These are used to customise an individual
--   scale transformation. To customise all scales use <tt>config</tt> and
--   supply relevant <a>ScaleConfig</a> values. For more details see the
--   <a>Vega-Lite documentation</a>.
data ScaleProperty
SType :: Scale -> ScaleProperty
SDomain :: ScaleDomain -> ScaleProperty
SRange :: ScaleRange -> ScaleProperty
SScheme :: Text -> [Double] -> ScaleProperty
SPadding :: Double -> ScaleProperty
SPaddingInner :: Double -> ScaleProperty
SPaddingOuter :: Double -> ScaleProperty
SRangeStep :: Maybe Double -> ScaleProperty
SRound :: Bool -> ScaleProperty
SClamp :: Bool -> ScaleProperty
SInterpolate :: CInterpolate -> ScaleProperty
SNice :: ScaleNice -> ScaleProperty
SZero :: Bool -> ScaleProperty
SReverse :: Bool -> ScaleProperty

-- | Used to indicate the type of scale transformation to apply.
data Scale
ScLinear :: Scale
ScPow :: Scale
ScSqrt :: Scale
ScLog :: Scale
ScTime :: Scale
ScUtc :: Scale
ScSequential :: Scale
ScOrdinal :: Scale
ScBand :: Scale
ScPoint :: Scale
ScBinLinear :: Scale
ScBinOrdinal :: Scale

-- | Create a set of discrete domain to color mappings suitable for
--   customising categorical scales. The first item in each tuple should be
--   a domain value and the second the color value with which it should be
--   associated. It is a convenience function equivalent to specifying
--   separate <a>SDomain</a> and <a>SRange</a> lists and is safer as it
--   guarantees a one-to-one correspondence between domain and range
--   values.
--   
--   <pre>
--   color
--       [ MName "weather"
--       , MmType Nominal
--       , MScale (
--           categoricalDomainMap
--               [ ( "sun", "yellow" )
--               , ( "rain", "blue" )
--               , ( "fog", "grey" )
--               ]
--           )
--       ]
--   </pre>
categoricalDomainMap :: [(Text, Text)] -> [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. This is a convenience function
--   equivalent to specifying separate <a>SDomain</a> and <a>SRange</a>
--   lists and is safer as it guarantees a one-to-one correspondence
--   between domain and range values.
--   
--   <pre>
--   color
--       [ MName "year"
--       , MmType Ordinal
--       , MScale (domainRangeMap ( 1955, "911a24" ))
--       ]
--   </pre>
domainRangeMap :: (Double, Text) -> (Double, Text) -> [ScaleProperty]

-- | Describes the scale domain (type of data in scale). For full details
--   see the <a>Vega-Lite documentation</a>.
data ScaleDomain
DNumbers :: [Double] -> ScaleDomain
DStrings :: [Text] -> ScaleDomain
DDateTimes :: [[DateTime]] -> ScaleDomain
DSelection :: Text -> ScaleDomain
Unaggregated :: ScaleDomain

-- | Describes a scale range of scale output values. For full details see
--   the <a>Vega-Lite documentation</a>.
data ScaleRange
RNumbers :: [Double] -> ScaleRange
RStrings :: [Text] -> ScaleRange
RName :: Text -> ScaleRange

-- | Describes the way a scale can be rounded to "nice" numbers. For full
--   details see the <a>Vega-Lite documentation</a>.
data ScaleNice
NMillisecond :: ScaleNice
NSecond :: ScaleNice
NMinute :: ScaleNice
NHour :: ScaleNice
NDay :: ScaleNice
NWeek :: ScaleNice
NMonth :: ScaleNice
NYear :: ScaleNice
NInterval :: TimeUnit -> Int -> ScaleNice
IsNice :: Bool -> ScaleNice
NTickCount :: Int -> ScaleNice

-- | Indicates the type of color interpolation to apply, when mapping a
--   data field onto a color scale. Note that color interpolation cannot be
--   applied with the default "sequential" color scale
--   (<a>ScSequential</a>), so additionally, you should set the
--   <a>SType</a> to another continuous scale such as <a>ScLinear</a> and
--   <a>ScPow</a>.
--   
--   For details see the <a>Vega-Lite documentation</a>.
data CInterpolate

-- | The numeric value is the gamma value for the scheme (the recommended
--   value is 1).
CubeHelix :: Double -> CInterpolate

-- | The numeric value is the gamma value for the scheme (the recommended
--   value is 1).
CubeHelixLong :: Double -> CInterpolate
Hcl :: CInterpolate
HclLong :: CInterpolate
Hsl :: CInterpolate
HslLong :: CInterpolate
Lab :: CInterpolate

-- | The numeric value is the gamma value for the scheme (the recommended
--   value is 1).
Rgb :: Double -> CInterpolate

-- | Assigns a list of specifications to superposed layers in a
--   visualization.
--   
--   <pre>
--   toVegaLite
--       [ dataFromUrl "data/driving.json" []
--       , layer [ spec1, spec2 ]
--       ]
--   </pre>
layer :: [VLSpec] -> (VLProperty, VLSpec)

-- | Assigns a list of specifications to be juxtaposed horizontally in a
--   visualization.
--   
--   <pre>
--   toVegaLite
--       [ dataFromUrl "data/driving.json" []
--       , hConcat [ spec1, spec2 ]
--       ]
--   </pre>
hConcat :: [VLSpec] -> (VLProperty, VLSpec)

-- | Assigns a list of specifications to be juxtaposed vertically in a
--   visualization.
--   
--   <pre>
--   toVegaLite
--       [ dataFromUrl "data/driving.json" []
--       , vConcat [ spec1, spec2 ]
--       ]
--   </pre>
vConcat :: [VLSpec] -> (VLProperty, VLSpec)

-- | Determine whether scales, axes or legends in composite views should
--   share channel encodings. This allows, for example, two different color
--   encodings to be created in a layered view, which otherwise by default
--   would share color channels between layers. Each resolution rule should
--   be in a tuple pairing the channel to which it applies and the rule
--   type.
--   
--   <pre>
--   let res = resolve
--               . resolution (RLegend [ ( ChColor, Independent ) ])
--   in toVegaLite
--       [ dataFromUrl "data/movies.json" []
--       , vConcat [ heatSpec, barSpec ]
--       , res []
--       ]
--   </pre>
--   
--   For more information see the <a>Vega-Lite documentation</a>.
resolve :: [LabelledSpec] -> (VLProperty, VLSpec)

-- | Define a single resolution option to be applied when scales, axes or
--   legends in composite views share channel encodings. This allows, for
--   example, two different color encodings to be created in a layered
--   view, which otherwise by default would share color channels between
--   layers. Each resolution rule should be in a tuple pairing the channel
--   to which it applies and the rule type.
--   
--   <pre>
--   resolve
--       . resolution (RScale [ ( ChY, Independent ) ])
--   </pre>
resolution :: Resolve -> BuildLabelledSpecs

-- | Used to determine how a channel's axis, scale or legend domains should
--   be resolved if defined in more than one view in a composite
--   visualization. See the <a>Vega-Lite documentation</a> for details.
data Resolve
RAxis :: [(Channel, Resolution)] -> Resolve
RLegend :: [(Channel, Resolution)] -> Resolve
RScale :: [(Channel, Resolution)] -> Resolve

-- | Indicates a channel type to be used in a resolution specification.
data Channel
ChX :: Channel
ChY :: Channel
ChX2 :: Channel
ChY2 :: Channel
ChColor :: Channel
ChOpacity :: Channel
ChShape :: Channel
ChSize :: Channel

-- | Indicates whether or not a scale domain should be independent of
--   others in a composite visualization. See the <a>Vega-Lite
--   documentation</a> for details.
data Resolution
Shared :: Resolution
Independent :: Resolution

-- | Define the fields that will be used to compose rows and columns of a
--   set of small multiples. This is used where the encoding of the
--   visualization in small multiples is largely identical, but the data
--   field used in each might vary. When a list of fields is identified
--   with <tt>repeat</tt> you also need to define a full specification to
--   apply to each of those fields using <a>asSpec</a>.
--   
--   <pre>
--   toVegaLite
--       [ repeat [ ColumnFields [ "Cat", "Dog", "Fish" ] ]
--       , specification (asSpec spec)
--       ]
--   </pre>
--   
--   See the <a>Vega-Lite documentation</a> for further details.
repeat :: [RepeatFields] -> (VLProperty, VLSpec)

-- | Create a list of fields to use in set of repeated small multiples. The
--   list of fields named here can be referenced in an encoding with
--   <tt>PRepeat Column</tt> or <tt>PRepeat Row</tt>.
data RepeatFields
RowFields :: [Text] -> RepeatFields
ColumnFields :: [Text] -> RepeatFields

-- | Defines the fields that will be used to facet a view in rows or
--   columns to create a set of small multiples. This is used where the
--   encoding of the visualization in small multiples is identical, but
--   data for each is grouped by the given fields. When creating a faceted
--   view in this way you also need to define a full specification to apply
--   to each of those facets using <a>asSpec</a>.
--   
--   <pre>
--   toVegaLite
--       [ facet [ RowBy [ FName "Origin", FmType Nominal ] ]
--       , specifcation spec
--       ]
--   </pre>
--   
--   See the <a>Vega-Lite documentation</a> for further details.
facet :: [FacetMapping] -> (VLProperty, VLSpec)

-- | Provides details of the mapping between a row or column and its field
--   definitions in a set of faceted small multiples. For details see the
--   <a>Vega-Lite documentation</a>.
data FacetMapping
ColumnBy :: [FacetChannel] -> FacetMapping
RowBy :: [FacetChannel] -> FacetMapping

-- | Types of facet channel property used for creating a composed facet
--   view of small multiples.
data FacetChannel
FName :: Text -> FacetChannel
FmType :: Measurement -> FacetChannel
FBin :: [BinProperty] -> FacetChannel
FAggregate :: Operation -> FacetChannel
FTimeUnit :: TimeUnit -> FacetChannel
FHeader :: [HeaderProperty] -> FacetChannel

-- | Create a specification sufficient to define an element in a composed
--   visualization such as a superposed layer or juxtaposed facet.
--   Typically a layer will contain a full set of specifications that
--   define a visualization with the exception of the data specification
--   which is usually defined outside of any one layer. Whereas for
--   repeated and faceted specs, the entire specification is provided.
--   
--   <pre>
--   spec1 = asSpec [ enc1 [], mark Line [] ]
--   </pre>
asSpec :: [(VLProperty, VLSpec)] -> VLSpec

-- | Defines a specification object for use with faceted and repeated small
--   multiples.
--   
--   <pre>
--   toVegaLite
--       [ facet [ RowBy [ FName "Origin", FmType Nominal ] ]
--       , specifcation spec
--       ]
--   </pre>
specification :: VLSpec -> (VLProperty, VLSpec)

-- | Identifies whether a repeated or faceted view is arranged in rows or
--   columns.
data Arrangement
Column :: Arrangement
Row :: Arrangement

-- | Represents a facet header property. For details, see the <a>Vega-Lite
--   documentation</a>.
data HeaderProperty
HFormat :: Text -> HeaderProperty
HTitle :: Text -> HeaderProperty

-- | Create a full selection specification from a list of selections. For
--   details see the <a>Vega-Lite documentation</a>.
--   
--   <pre>
--   selection = selection . select "view" Interval [ BindScales ]
--   </pre>
selection :: [LabelledSpec] -> (VLProperty, VLSpec)

-- | Create a single named selection that may be applied to a data query or
--   transformation.
--   
--   <pre>
--   sel =
--       selection
--           . select "view" Interval [ BindScales ] []
--           . select "myBrush" Interval []
--           . select "myPaintbrush" Multi [ On "mouseover", Nearest True ]
--   </pre>
select :: Text -> Selection -> [SelectionProperty] -> BuildLabelledSpecs

-- | Indicates the type of selection to be generated by the user.
data Selection

-- | Allows one mark at a time to be selected.
Single :: Selection

-- | Allows multiple items to be selected (e.g. with shift-click).
Multi :: Selection

-- | Allows a bounding rectangle to be dragged by the user, selecting all
--   items which intersect it.
Interval :: Selection

-- | Properties for customising the nature of the selection. See the
--   <a>Vega-Lite documentation</a> for details.
data SelectionProperty

-- | A <a>Vega event stream</a> or the empty string (which sets the
--   property to <tt>false</tt>).
On :: Text -> SelectionProperty

-- | A <a>Vega event stream</a> or the empty string (which sets the
--   property to <tt>false</tt>).
Translate :: Text -> SelectionProperty

-- | A <a>Vega event stream</a> or the empty string (which sets the
--   property to <tt>false</tt>).
Zoom :: Text -> SelectionProperty
Fields :: [Text] -> SelectionProperty
Encodings :: [Channel] -> SelectionProperty
Empty :: SelectionProperty
ResolveSelections :: SelectionResolution -> SelectionProperty
SelectionMark :: [SelectionMarkProperty] -> SelectionProperty
BindScales :: SelectionProperty
Bind :: [Binding] -> SelectionProperty
Nearest :: Bool -> SelectionProperty

-- | A <a>Vega expression</a> that evaluates to <tt>true</tt> or
--   <tt>false</tt>.
Toggle :: Text -> SelectionProperty

-- | Describes the binding property of a selection based on some HTML input
--   element such as a checkbox or radio button. For details see the
--   <a>Vega-Lite documentation</a> and the <a>Vega input binding
--   documentation</a>.
data Binding
IRange :: Text -> [InputProperty] -> Binding
ICheckbox :: Text -> [InputProperty] -> Binding
IRadio :: Text -> [InputProperty] -> Binding
ISelect :: Text -> [InputProperty] -> Binding
IText :: Text -> [InputProperty] -> Binding
INumber :: Text -> [InputProperty] -> Binding
IDate :: Text -> [InputProperty] -> Binding
ITime :: Text -> [InputProperty] -> Binding
IMonth :: Text -> [InputProperty] -> Binding
IWeek :: Text -> [InputProperty] -> Binding
IDateTimeLocal :: Text -> [InputProperty] -> Binding
ITel :: Text -> [InputProperty] -> Binding
IColor :: Text -> [InputProperty] -> Binding

-- | GUI Input properties. The type of relevant property will depend on the
--   type of input element selected. For example an <tt>InRange</tt>
--   (slider) can have numeric min, max and step values; <tt>InSelect</tt>
--   (selector) has a list of selection label options. For details see the
--   <a>Vega input element binding documentation</a>.
--   
--   The <tt>debounce</tt> property, available for all input types allows a
--   delay in input event handling to be added in order to avoid
--   unnecessary event broadcasting. The <tt>Element</tt> property is an
--   optional CSS selector indicating the parent element to which the input
--   element should be added. This allows the option of the input element
--   to be outside the visualization container.
data InputProperty
Debounce :: Double -> InputProperty
Element :: Text -> InputProperty
InOptions :: [Text] -> InputProperty
InMin :: Double -> InputProperty
InMax :: Double -> InputProperty
InName :: Text -> InputProperty
InStep :: Double -> InputProperty
InPlaceholder :: Text -> InputProperty

-- | Determines how selections in faceted or repeated views are resolved.
--   See the <a>Vega-Lite documentation</a> for details
data SelectionResolution
Global :: SelectionResolution
Union :: SelectionResolution
Intersection :: SelectionResolution

-- | Properties for customising the appearance of an interval selection
--   mark (dragged rectangle). For details see the <a>Vega-Lite
--   documentation</a>.
data SelectionMarkProperty
SMFill :: Text -> SelectionMarkProperty
SMFillOpacity :: Double -> SelectionMarkProperty
SMStroke :: Text -> SelectionMarkProperty
SMStrokeOpacity :: Double -> SelectionMarkProperty
SMStrokeWidth :: Double -> SelectionMarkProperty
SMStrokeDash :: [Double] -> SelectionMarkProperty
SMStrokeDashOffset :: Double -> SelectionMarkProperty

-- | Used for creating logical compositions. For example
--   
--   <pre>
--   color
--       [ MSelectionCondition (Or (SelectionName "alex") (SelectionName "morgan"))
--           [ MAggregate Count, MName "*", MmType Quantitative ]
--           [ MString "gray" ]
--       ]
--   </pre>
--   
--   Logical compositions can be nested to any level as shown in this
--   example
--   
--   <pre>
--   Not (And (Expr "datum.IMDB_Rating === null") (Expr "datum.Rotten_Tomatoes_Rating === null") )
--   </pre>
data BooleanOp
Expr :: Text -> BooleanOp
Selection :: Text -> BooleanOp
SelectionName :: Text -> BooleanOp
And :: BooleanOp -> BooleanOp -> BooleanOp
Or :: BooleanOp -> BooleanOp -> BooleanOp
Not :: BooleanOp -> BooleanOp

-- | Provides an optional name to be associated with the visualization.
--   
--   <pre>
--   toVegaLite
--       [ name "PopGrowth"
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
name :: Text -> (VLProperty, VLSpec)

-- | Provide an optional title to be displayed in the visualization.
--   
--   <pre>
--   toVegaLite
--       [ title "Population Growth"
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
title :: Text -> (VLProperty, VLSpec)

-- | Provides an optional description to be associated with the
--   visualization.
--   
--   <pre>
--   toVegaLite
--       [ description "Population change of key regions since 1900"
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
description :: Text -> (VLProperty, VLSpec)

-- | Overrides the default height of the visualization. If not specified
--   the height will be calculated based on the content of the
--   visualization.
--   
--   <pre>
--   toVegaLite
--       [ height 300
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
height :: Double -> (VLProperty, VLSpec)

-- | Override the default width of the visualization. If not specified the
--   width will be calculated based on the content of the visualization.
--   
--   <pre>
--   toVegaLite
--       [ width 500
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
width :: Double -> (VLProperty, VLSpec)

-- | Set the padding around the visualization in pixel units. The way
--   padding is interpreted will depend on the <a>autosize</a> properties.
--   See the <a>Vega-Lite documentation</a> for details.
--   
--   <pre>
--   toVegaLite
--       [ width 500
--       , padding (PEdges 20 10 5 15)
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
padding :: Padding -> (VLProperty, VLSpec)

-- | Declare the way the view is sized. See the <a>Vega-Lite
--   documentation</a> for details.
--   
--   <pre>
--   toVegaLite
--       [ width 250
--       , height 300
--       , autosize [ AFit, APadding, AResize ]
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
autosize :: [Autosize] -> (VLProperty, VLSpec)

-- | Set the background color of the visualization. Should be specified
--   with a CSS string such as "#ffe" or "rgb(200,20,150)". If not
--   specified the background will be transparent.
--   
--   <pre>
--   toVegaLite
--       [ background "rgb(251,247,238)"
--       , dataFromUrl "data/population.json" []
--       , mark Bar []
--       , enc []
--       ]
--   </pre>
background :: Text -> (VLProperty, VLSpec)

-- | Create a single global configuration from a list of configuration
--   specifications. Configurations are applied to all relevant items in
--   the specification. See the <a>Vega-Lite documentation</a> for more
--   details.
--   
--   <pre>
--   config =
--       configure
--           . configuration (Axis [ DomainWidth 1 ])
--           . configuration (View [ Stroke (Just "transparent") ])
--           . configuration (SelectionStyle [ ( Single, [ On "dblclick" ] ) ])
--   </pre>
configure :: [LabelledSpec] -> (VLProperty, VLSpec)

-- | Defines a single configuration option to be applied globally across
--   the visualization. The first parameter identifies the type of
--   configuration, the second a list of previous configurations to which
--   this one may be added.
--   
--   <pre>
--   configuration (Axis [ DomainWidth 4 ]) []
--   </pre>
configuration :: ConfigurationProperty -> BuildLabelledSpecs

-- | Type of configuration property to customise. See the <a>Vega-Lite
--   documentation</a> for details.
data ConfigurationProperty
AreaStyle :: [MarkProperty] -> ConfigurationProperty
Autosize :: [Autosize] -> ConfigurationProperty
Axis :: [AxisConfig] -> ConfigurationProperty
AxisX :: [AxisConfig] -> ConfigurationProperty
AxisY :: [AxisConfig] -> ConfigurationProperty
AxisLeft :: [AxisConfig] -> ConfigurationProperty
AxisRight :: [AxisConfig] -> ConfigurationProperty
AxisTop :: [AxisConfig] -> ConfigurationProperty
AxisBottom :: [AxisConfig] -> ConfigurationProperty
AxisBand :: [AxisConfig] -> ConfigurationProperty
Background :: Text -> ConfigurationProperty
BarStyle :: [MarkProperty] -> ConfigurationProperty
CircleStyle :: [MarkProperty] -> ConfigurationProperty
CountTitle :: Text -> ConfigurationProperty
FieldTitle :: FieldTitleProperty -> ConfigurationProperty
Legend :: [LegendConfig] -> ConfigurationProperty
LineStyle :: [MarkProperty] -> ConfigurationProperty
MarkStyle :: [MarkProperty] -> ConfigurationProperty
NamedStyle :: Text -> [MarkProperty] -> ConfigurationProperty
NumberFormat :: Text -> ConfigurationProperty
Padding :: Padding -> ConfigurationProperty
PointStyle :: [MarkProperty] -> ConfigurationProperty
Projection :: [ProjectionProperty] -> ConfigurationProperty
Range :: [RangeConfig] -> ConfigurationProperty
RectStyle :: [MarkProperty] -> ConfigurationProperty
RemoveInvalid :: Bool -> ConfigurationProperty
RuleStyle :: [MarkProperty] -> ConfigurationProperty
Scale :: [ScaleConfig] -> ConfigurationProperty
SelectionStyle :: [(Selection, [SelectionProperty])] -> ConfigurationProperty
SquareStyle :: [MarkProperty] -> ConfigurationProperty
Stack :: StackProperty -> ConfigurationProperty
TextStyle :: [MarkProperty] -> ConfigurationProperty
TickStyle :: [MarkProperty] -> ConfigurationProperty
TitleStyle :: [TitleConfig] -> ConfigurationProperty
TimeFormat :: Text -> ConfigurationProperty
View :: [ViewConfig] -> ConfigurationProperty

-- | Indicates the auto-sizing characteristics of the visualization such as
--   amount of padding, whether it should fill the parent container etc.
--   For more details see the <a>Vega-Lite documentation</a>.
data Autosize
AContent :: Autosize
AFit :: Autosize
ANone :: Autosize
APad :: Autosize
APadding :: Autosize
AResize :: Autosize

-- | Specify the padding dimensions in pixel units.
data Padding

-- | Use the same padding on all four edges of the container.
PSize :: Double -> Padding

-- | Specify the padding for the left, top, right, and bottom edges.
PEdges :: Double -> Double -> Double -> Double -> Padding

-- | Axis configuration options for customising all axes. See the
--   <a>Vega-Lite documentation</a> for more details.
data AxisConfig
BandPosition :: Double -> AxisConfig
Domain :: Bool -> AxisConfig
DomainColor :: Text -> AxisConfig
DomainWidth :: Double -> AxisConfig
MaxExtent :: Double -> AxisConfig
MinExtent :: Double -> AxisConfig
Grid :: Bool -> AxisConfig
GridColor :: Text -> AxisConfig
GridDash :: [Double] -> AxisConfig
GridOpacity :: Double -> AxisConfig
GridWidth :: Double -> AxisConfig
Labels :: Bool -> AxisConfig
LabelAngle :: Double -> AxisConfig
LabelColor :: Text -> AxisConfig
LabelFont :: Text -> AxisConfig
LabelFontSize :: Double -> AxisConfig
LabelLimit :: Double -> AxisConfig
LabelOverlap :: OverlapStrategy -> AxisConfig
LabelPadding :: Double -> AxisConfig
ShortTimeLabels :: Bool -> AxisConfig
Ticks :: Bool -> AxisConfig
TickColor :: Text -> AxisConfig
TickRound :: Bool -> AxisConfig
TickSize :: Double -> AxisConfig
TickWidth :: Double -> AxisConfig
TitleAlign :: HAlign -> AxisConfig
TitleAngle :: Double -> AxisConfig
TitleBaseline :: VAlign -> AxisConfig
TitleColor :: Text -> AxisConfig
TitleFont :: Text -> AxisConfig
TitleFontWeight :: FontWeight -> AxisConfig
TitleFontSize :: Double -> AxisConfig
TitleLimit :: Double -> AxisConfig
TitleMaxLength :: Double -> AxisConfig
TitlePadding :: Double -> AxisConfig
TitleX :: Double -> AxisConfig
TitleY :: Double -> AxisConfig

-- | Legend configuration options. For more detail see the <a>Vega-Lite
--   documentation</a>.
data LegendConfig
CornerRadius :: Double -> LegendConfig
FillColor :: Text -> LegendConfig
Orient :: LegendOrientation -> LegendConfig
Offset :: Double -> LegendConfig
StrokeColor :: Text -> LegendConfig
LeStrokeDash :: [Double] -> LegendConfig
LeStrokeWidth :: Double -> LegendConfig
LePadding :: Double -> LegendConfig
GradientLabelBaseline :: VAlign -> LegendConfig
GradientLabelLimit :: Double -> LegendConfig
GradientLabelOffset :: Double -> LegendConfig
GradientStrokeColor :: Text -> LegendConfig
GradientStrokeWidth :: Double -> LegendConfig
GradientHeight :: Double -> LegendConfig
GradientWidth :: Double -> LegendConfig
LeLabelAlign :: HAlign -> LegendConfig
LeLabelBaseline :: VAlign -> LegendConfig
LeLabelColor :: Text -> LegendConfig
LeLabelFont :: Text -> LegendConfig
LeLabelFontSize :: Double -> LegendConfig
LeLabelLimit :: Double -> LegendConfig
LeLabelOffset :: Double -> LegendConfig
LeShortTimeLabels :: Bool -> LegendConfig
EntryPadding :: Double -> LegendConfig
SymbolColor :: Text -> LegendConfig
SymbolType :: Symbol -> LegendConfig
SymbolSize :: Double -> LegendConfig
SymbolStrokeWidth :: Double -> LegendConfig
LeTitleAlign :: HAlign -> LegendConfig
LeTitleBaseline :: VAlign -> LegendConfig
LeTitleColor :: Text -> LegendConfig
LeTitleFont :: Text -> LegendConfig
LeTitleFontSize :: Double -> LegendConfig
LeTitleFontWeight :: FontWeight -> LegendConfig
LeTitleLimit :: Double -> LegendConfig
LeTitlePadding :: Double -> LegendConfig

-- | Scale configuration property. These are used to configure all scales.
--   For more details see the <a>Vega-Lite documentation</a>.
data ScaleConfig
SCBandPaddingInner :: Double -> ScaleConfig
SCBandPaddingOuter :: Double -> ScaleConfig
SCClamp :: Bool -> ScaleConfig
SCMaxBandSize :: Double -> ScaleConfig
SCMinBandSize :: Double -> ScaleConfig
SCMaxFontSize :: Double -> ScaleConfig
SCMinFontSize :: Double -> ScaleConfig
SCMaxOpacity :: Double -> ScaleConfig
SCMinOpacity :: Double -> ScaleConfig
SCMaxSize :: Double -> ScaleConfig
SCMinSize :: Double -> ScaleConfig
SCMaxStrokeWidth :: Double -> ScaleConfig
SCMinStrokeWidth :: Double -> ScaleConfig
SCPointPadding :: Double -> ScaleConfig
SCRangeStep :: Maybe Double -> ScaleConfig
SCRound :: Bool -> ScaleConfig
SCTextXRangeStep :: Double -> ScaleConfig
SCUseUnaggregatedDomain :: Bool -> ScaleConfig

-- | Title configuration properties. These are used to configure the
--   default style of all titles within a visualization. For further
--   details see the <a>Vega-Lite documentation</a>.
data TitleConfig
TAnchor :: APosition -> TitleConfig
TAngle :: Double -> TitleConfig
TBaseline :: VAlign -> TitleConfig
TColor :: Text -> TitleConfig
TFont :: Text -> TitleConfig
TFontSize :: Double -> TitleConfig
TFontWeight :: FontWeight -> TitleConfig
TLimit :: Double -> TitleConfig
TOffset :: Double -> TitleConfig
TOrient :: Side -> TitleConfig

-- | Indicates the anchor position for text.
data APosition
AStart :: APosition
AMiddle :: APosition
AEnd :: APosition

-- | View configuration property. These are used to configure the style of
--   a single view within a visualization such as its size and default fill
--   and stroke colors. For further details see the <a>Vega-Lite
--   documentation</a>.
data ViewConfig
ViewWidth :: Double -> ViewConfig
ViewHeight :: Double -> ViewConfig
Clip :: Bool -> ViewConfig
Fill :: Maybe Text -> ViewConfig
FillOpacity :: Double -> ViewConfig
Stroke :: Maybe Text -> ViewConfig
StrokeOpacity :: Double -> ViewConfig
StrokeWidth :: Double -> ViewConfig
StrokeDash :: [Double] -> ViewConfig
StrokeDashOffset :: Double -> ViewConfig

-- | Properties for customising the colors of a range. The parameter should
--   be a named color scheme such as <tt>"accent"</tt> or
--   <tt>"purpleorange-11"</tt>. For details see the <a>Vega-Lite
--   documentation</a>.
data RangeConfig
RCategory :: Text -> RangeConfig
RDiverging :: Text -> RangeConfig
RHeatmap :: Text -> RangeConfig
ROrdinal :: Text -> RangeConfig
RRamp :: Text -> RangeConfig
RSymbol :: Text -> RangeConfig

-- | Indicates the style in which field names are displayed.
data FieldTitleProperty

-- | Creates "Sum of field", "Year of date", "field (binned)", etc.
Verbal :: FieldTitleProperty

-- | Creates "SUM(field)", "YEAR(date)", "BIN(field)", etc.
Function :: FieldTitleProperty

-- | Just use the field name without any extra text.
Plain :: FieldTitleProperty

-- | A single data value. This is used when a function can accept values of
--   different types (e.g. either a number or a string).
data DataValue
Boolean :: Bool -> DataValue
DateTime :: [DateTime] -> DataValue
Number :: Double -> DataValue
Str :: Text -> DataValue

-- | A list of data values. This is used when a function can accept lists
--   of different types (e.g. either a list of numbers or a list of
--   strings).
data DataValues
Booleans :: [Bool] -> DataValues
DateTimes :: [[DateTime]] -> DataValues
Numbers :: [Double] -> DataValues
Strings :: [Text] -> DataValues

-- | Allows a date or time to be represented. This is typically part of a
--   list of <tt>DateTime</tt> items to provide a specific point in time.
--   For details see the <a>Vega-Lite documentation</a>.
data DateTime
DTYear :: Int -> DateTime
DTQuarter :: Int -> DateTime
DTMonth :: MonthName -> DateTime
DTDate :: Int -> DateTime
DTDay :: DayName -> DateTime
DTHours :: Int -> DateTime
DTMinutes :: Int -> DateTime
DTSeconds :: Int -> DateTime
DTMilliseconds :: Int -> DateTime

-- | Identifies a month of the year.
data MonthName
Jan :: MonthName
Feb :: MonthName
Mar :: MonthName
Apr :: MonthName
May :: MonthName
Jun :: MonthName
Jul :: MonthName
Aug :: MonthName
Sep :: MonthName
Oct :: MonthName
Nov :: MonthName
Dec :: MonthName

-- | Identifies the day of the week.
data DayName
Mon :: DayName
Tue :: DayName
Wed :: DayName
Thu :: DayName
Fri :: DayName
Sat :: DayName
Sun :: DayName
