hvega 0.3.0.0 → 0.3.0.1
raw patch · 3 files changed
+211/−193 lines, 3 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.md +10/−0
- hvega.cabal +2/−2
- src/Graphics/Vega/VegaLite.hs +199/−191
CHANGELOG.md view
@@ -1,6 +1,16 @@ For the latest version of this document, please see [https://github.com/DougBurke/hvega/blob/master/hvega/CHANGELOG.md](https://github.com/DougBurke/hvega/blob/master/hvega/CHANGELOG.md). +## 0.3.0.1++The minimum base version has been bumped from 4.7 to 4.9, which+means ghc 8.0 or later. This is because the 0.2.0.1 release+does not appear to build with ghc 7.10. If this restriction is+a problem then please comment on the issues list.++There have been minor documentation updates, adding `@since`+annotations.+ ## 0.3.0.0 The `Channel` type has been extended to include `ChFill` and `ChStroke`
hvega.cabal view
@@ -1,5 +1,5 @@ name: hvega-version: 0.3.0.0+version: 0.3.0.1 synopsis: Create Vega-Lite visualizations (version 3) in Haskell. description: This is an almost-direct port of elm-vega (<http://package.elm-lang.org/packages/gicentre/elm-vega/2.2.1>)@@ -24,7 +24,7 @@ library hs-source-dirs: src exposed-modules: Graphics.Vega.VegaLite- build-depends: base >= 4.7 && < 5+ build-depends: base >= 4.9 && < 5 , aeson >= 0.11 && < 1.5 , text == 1.2.* , vector >= 0.11 && < 0.13
src/Graphics/Vega/VegaLite.hs view
@@ -52,7 +52,7 @@ @ \{\-\# language OverloadedStrings \#\-\} -vl1 = 'toVegaLite' ['description' desc, 'background' "white", 'dat' [], 'mark' 'Bar' 'barOpts', 'enc' []] where+vl1 = 'toVegaLite' ['description' desc, 'background' "white", 'dat' [], 'mark' 'Bar' 'barOpts', enc []] where desc = "A very exciting bar chart" dat = 'dataFromRows' ['Parse' [("start", 'FoDate' "%Y-%m-%d")]]@@ -445,15 +445,15 @@ -- the cylinder field with an ordinal color scheme, else make them grey\". -- -- @--- sel = selection . select "myBrush" Interval []+-- sel = 'selection' . 'select' "myBrush" 'Interval' [] ----- enc = encoding--- . position X [ PName \"Horsepower\", PmType Quantitative ]--- . position Y [ PName \"Miles_per_Gallon\", PmType Quantitative ]--- . color--- [ MSelectionCondition (SelectionName "myBrush")--- [ MName \"Cylinders\", MmType Ordinal ]--- [ MString "grey" ]+-- enc = 'encoding'+-- . 'position' 'X' [ 'PName' \"Horsepower\", 'PmType' 'Quantitative' ]+-- . position 'Y' [ PName \"Miles_per_Gallon\", PmType Quantitative ]+-- . 'color'+-- [ 'MSelectionCondition' ('SelectionName' "myBrush")+-- [ 'MName' \"Cylinders\", 'MmType' 'Ordinal' ]+-- [ 'MString' "grey" ] -- ] -- @ --@@ -465,8 +465,8 @@ -- . position X [ PName \"IMDB_Rating\", PmType Quantitative ] -- . position Y [ PName \"Rotten_Tomatoes_Rating\", PmType Quantitative ] -- . color--- [ MDataCondition--- (Or (Expr "datum.IMDB_Rating === null")+-- [ 'MDataCondition'+-- ('Or' ('Expr' "datum.IMDB_Rating === null") -- (Expr "datum.Rotten_Tomatoes_Rating === null") -- ) -- [ MString "#ddd" ]@@ -551,15 +551,15 @@ allows this to be done compactly. @-let dat = dataFromColumns []- . dataColumn "a" (Strings [ \"C", \"C", \"D", \"D", \"E", \"E" ])- . dataColumn "b" (Numbers [ 2, 7, 1, 2, 6, 8 ])+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 ]+ enc = 'encoding'+ . 'position' 'X' [ 'PName' "a", 'PmType' 'Nominal' ]+ . position 'Y' [ PName "b", 'PmType' 'Quantitative', 'PAggregate' 'Mean' ] -in toVegaLite [ dat [], mark Bar [], enc [] ]+in toVegaLite [ dat [], mark 'Bar' [], enc [] ] @ The schema used is <https://github.com/vega/schema version 3 of Vega-Lite>.@@ -595,6 +595,7 @@ Converts VegaLite to html Text. Uses Vega-Embed. +@since 0.2.1.0 -} toHtml :: VegaLite -> TL.Text toHtml vl = TL.unlines@@ -623,6 +624,7 @@ Converts VegaLite to an html file. Uses Vega-Embed. +@since 0.2.1.0 -} toHtmlFile :: FilePath -> VegaLite -> IO () toHtmlFile file = TL.writeFile file . toHtml@@ -652,8 +654,8 @@ @ geojson = geoFeatureCollection- [ geometry (GeoPolygon [ [ ( -3, 59 ), ( -3, 52 ), ( 4, 52 ), ( -3, 59 ) ] ])- [ ( "myRegionName", Str "Northern region" ) ]+ [ '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" ) ] ]@@ -675,8 +677,8 @@ @ geojson = geometryCollection- [ geometry (GeoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []- , geometry (GeoPoint -3.5 55.5) []+ [ 'geometry' ('GeoPolygon' [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []+ , geometry ('GeoPoint' -3.5 55.5) [] ] @ -}@@ -695,10 +697,10 @@ @ trans =- transform- . aggregate- [ opAs Min "people" "lowerBound"- , opAs Max "people" "upperBound"+ 'transform'+ . 'aggregate'+ [ opAs 'Min' "people" "lowerBound"+ , opAs 'Max' "people" "upperBound" ] [ "age" ] @@@ -874,10 +876,10 @@ Convenience type annotation label for use with data generation functions. @-myRegion : [DataColumn] -> Data+myRegion : ['DataColumn'] -> Data myRegion =- dataFromColumns []- . dataColumn "easting" (Numbers [ -3, 4, 4, -3, -3 ])+ 'dataFromColumns' []+ . 'dataColumn' "easting" ('Numbers' [ -3, 4, 4, -3, -3 ]) . dataColumn "northing" (Numbers [ 52, 52, 45, 45, 52 ]) @ -}@@ -919,7 +921,7 @@ The final parameter is the list of any other rows to which this is added. @-dataRow [(\"Animal\", Str \"Fish\"), (\"Age\",Number 28), (\"Year\", Str "2010")] []+dataRow [(\"Animal\", 'Str' \"Fish\"), (\"Age\", 'Number' 28), (\"Year\", Str "2010")] [] @ -} dataRow :: [(T.Text, DataValue)] -> [DataRow] -> [DataRow]@@ -936,8 +938,8 @@ let toJS = Data.Aeson.toJSON obj = Data.Aeson.object - data = dataFromRows []- . dataRow [ ( "cat", Str "a" ), ( "val", Number 10 ) ]+ 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 ) ]@@ -946,10 +948,10 @@ enc = ... -in toVegaLite- [ datasets [ ( "myData", data [] ), ( "myJson", dataFromJson json [] ) ]- , dataFromSource "myData" []- , mark Bar []+in 'toVegaLite'+ [ datasets [ ( "myData", data [] ), ( "myJson", 'dataFromJson' json [] ) ]+ , 'dataFromSource' "myData" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -986,9 +988,9 @@ @ data =- dataFromColumns [ Parse [ ( \"Year\", FoDate "%Y" ) ] ]- . dataColumn \"Animal\" (Strings [ \"Fish\", \"Dog\", \"Cat\" ])- . dataColumn \"Age\" (Numbers [ 28, 12, 6 ])+ dataFromColumns [ 'Parse' [ ( \"Year\", 'FoDate' "%Y" ) ] ]+ . 'dataColumn' \"Animal\" ('Strings' [ \"Fish\", \"Dog\", \"Cat\" ])+ . dataColumn \"Age\" ('Numbers' [ 28, 12, 6 ]) . dataColumn \"Year\" (Strings [ "2010", "2014", "2015" ]) @ -}@@ -1033,13 +1035,13 @@ @ let geojson =- geometry (GeoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []-in toVegaLite- [ width 200- , height 200+ 'geometry' ('GeoPolygon' [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []+in 'toVegaLite'+ [ 'width' 200+ , 'height' 200 , dataFromJson geojson []- , projection [ PType Orthographic ]- , mark Geoshape []+ , 'projection' [ 'PType' 'Orthographic' ]+ , 'mark' 'Geoshape' [] ] @ -}@@ -1090,7 +1092,7 @@ parameter is the list of any other columns to which this is added. @-dataColumn \"Animal\" (Strings [ \"Cat\", \"Dog\", \"Mouse\"]) []+dataColumn \"Animal\" ('Strings' [ \"Cat\", \"Dog\", \"Mouse\"]) [] @ -} dataColumn :: T.Text -> DataValues -> [DataColumn] -> [DataColumn]@@ -1123,8 +1125,8 @@ is more efficient and less error-prone. @-data = dataFromRows [ Parse [ ( \"Year\", FoDate "%Y" ) ] ]- . dataRow [ ( \"Animal\", Str \"Fish\" ), ( \"Age\", Number 28 ), ( \"Year\", Str "2010" ) ]+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" ) ] @@@ -1149,10 +1151,10 @@ for details. @-toVegaLite- [ datasets [ ( "myData", data [] ), ( "myJson", dataFromJson json [] ) ]+'toVegaLite'+ [ 'datasets' [ ( "myData", data [] ), ( "myJson", 'dataFromJson' json [] ) ] , dataFromSource "myData" []- , mark Bar []+ , 'mark' 'Bar' [] , enc [] ] @@@ -1176,9 +1178,9 @@ for details. @-toVegaLite- [ dataFromUrl "data/weather.csv" [ Parse [ ( "date", FoDate "%Y-%m-%d %H:%M" ) ] ]- , mark Line []+'toVegaLite'+ [ dataFromUrl "data/weather.csv" [ 'Parse' [ ( "date", 'FoDate' "%Y-%m-%d %H:%M" ) ] ]+ , 'mark' 'Line' [] , enc [] ] @@@ -1230,8 +1232,8 @@ for the second parameter. @-mark Circle []-mark Line [ MInterpolate StepAfter ]+mark 'Circle' []+mark 'Line' [ 'MInterpolate' 'StepAfter' ] @ -} mark :: Mark -> [MarkProperty] -> (VLProperty, VLSpec)@@ -1387,10 +1389,10 @@ @ enc = encoding- . position X [ PName \"Animal\", PmType Ordinal ]- . position Y [ PName \"Age\", PmType Quantitative ]- . shape [ MName \"Species\", MmType Nominal ]- . size [ MName \"Population\", MmType Quantitative ]+ . 'position' 'X' [ 'PName' \"Animal\", 'PmType' 'Ordinal' ]+ . position 'Y' [ PName \"Age\", PmType 'Quantitative' ]+ . 'shape' [ 'MName' \"Species\", 'MmType' 'Nominal' ]+ . 'size' [ MName \"Population\", MmType Quantitative ] @ -} encoding :: [LabelledSpec] -> (VLProperty, VLSpec)@@ -1581,8 +1583,13 @@ | SInterpolate CInterpolate | SNice ScaleNice | SZero Bool- -- TODO: Check: This is a Vega, not Vega-Lite property so can generate a warning if validated against the Vega-Lite spec.+ -- TODO: remove this | SReverse Bool+ -- ^ This is a Vega, rather than Vega-Lite, property and its use will generate+ -- warnings when you validate the JSON against the schema. The order+ -- of a scale (e.g. axis) can be reversed by setting @'PSort' ['Descending']@.+ --+ -- This property will be removed in a future release. scaleProperty :: ScaleProperty -> LabelledSpec@@ -1847,14 +1854,14 @@ {-| 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+string such as @\"#ffe\"@ or @\"rgb(200,20,150)\"@. If not specified the background will be transparent. @-toVegaLite+'toVegaLite' [ background "rgb(251,247,238)"- , dataFromUrl "data/population.json" []- , mark Bar []+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -1868,10 +1875,10 @@ Provides an optional description to be associated with the visualization. @-toVegaLite+'toVegaLite' [ description "Population change of key regions since 1900"- , dataFromUrl "data/population.json" []- , mark Bar []+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -1885,10 +1892,10 @@ Provide an optional title to be displayed in the visualization. @-toVegaLite+'toVegaLite' [ title "Population Growth"- , dataFromUrl "data/population.json" []- , mark Bar []+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -2075,8 +2082,8 @@ for further details. @-encoding- . position X [ PName "date", PmType Temporal, PTimeUnit (Utc YearMonthDateHours) ]+'encoding'+ . 'position' 'X' [ 'PName' "date", 'PmType' 'Temporal', 'PTimeUnit' (Utc 'YearMonthDateHours') ] @ -} @@ -2397,12 +2404,12 @@ for details. @-toVegaLite- [ width 250- , height 300- , autosize [ AFit, APadding, AResize ]- , dataFromUrl "data/population.json" []- , mark Bar []+'toVegaLite'+ [ 'width' 250+ , 'height' 300+ , autosize [ 'AFit', 'APadding', 'AResize' ]+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -2671,7 +2678,7 @@ {-| 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+pairs into planar @(x,y)@ coordinate pairs for rendering and query. For details see the <https://vega.github.io/vega-lite/docs/projection.html Vega-Lite documentation>. -} data ProjectionProperty@@ -2876,8 +2883,8 @@ | ChX2 | ChY2 | ChColor- | ChFill- | ChStroke+ | ChFill -- ^ @since 0.3.0.0+ | ChStroke -- ^ @since 0.3.0.0 | ChOpacity | ChShape | ChSize@@ -3277,10 +3284,10 @@ Used for creating logical compositions. For example @-color- [ MSelectionCondition (Or (SelectionName "alex") (SelectionName "morgan"))- [ MAggregate Count, MName "*", MmType Quantitative ]- [ MString "gray" ]+'color'+ [ 'MSelectionCondition' (Or ('SelectionName' "alex") (SelectionName "morgan"))+ [ 'MAggregate' 'Count', 'MName' "*", 'MmType' 'Quantitative' ]+ [ 'MString' "gray" ] ] @ @@ -3358,7 +3365,7 @@ @ geojson =- geometry (GeoPolygon [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) []+ geometry ('GeoPolygon' [ [ ( -3, 59 ), ( 4, 59 ), ( 4, 52 ), ( -3, 59 ) ] ]) [] @ -} geometry :: Geometry -> [(T.Text, DataValue)] -> VLSpec@@ -3497,10 +3504,10 @@ domain and range values. @-color- [ MName "year"- , MmType Ordinal- , MScale (domainRangeMap ( 1955, "#e6959c" ) ( 2000, "#911a24" ))+'color'+ [ 'MName' "year"+ , 'MmType' 'Ordinal'+ , 'MScale' (domainRangeMap ( 1955, "#e6959c" ) ( 2000, "#911a24" )) ] @ -}@@ -3520,10 +3527,10 @@ a one-to-one correspondence between domain and range values. @-color- [ MName "weather"- , MmType Nominal- , MScale (+'color'+ [ 'MName' "weather"+ , 'MmType' Nominal+ , 'MScale' ( categoricalDomainMap [ ( "sun", "yellow" ) , ( "rain", "blue" )@@ -3687,9 +3694,9 @@ @ config = configure- . configuration (Axis [ DomainWidth 1 ])- . configuration (View [ Stroke (Just "transparent") ])- . configuration (SelectionStyle [ ( Single, [ On "dblclick" ] ) ])+ . 'configuration' ('Axis' [ 'DomainWidth' 1 ])+ . configuration ('View' [ 'Stroke' (Just "transparent") ])+ . configuration ('SelectionStyle' [ ( 'Single', [ 'On' "dblclick" ] ) ]) @ -} configure :: [LabelledSpec] -> (VLProperty, VLSpec)@@ -3705,9 +3712,9 @@ to apply to each of those facets using 'asSpec'. @-toVegaLite- [ facet [ RowBy [ FName \"Origin\", FmType Nominal ] ]- , specifcation spec+'toVegaLite'+ [ facet [ 'RowBy' [ 'FName' \"Origin\", 'FmType' 'Nominal' ] ]+ , 'specifcation' spec ] @ @@ -3727,10 +3734,10 @@ will be calculated based on the content of the visualization. @-toVegaLite+'toVegaLite' [ height 300- , dataFromUrl "data/population.json" []- , mark Bar []+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -3744,8 +3751,8 @@ Assigns a list of specifications to be juxtaposed horizontally in a visualization. @-toVegaLite- [ dataFromUrl "data/driving.json" []+'toVegaLite'+ [ 'dataFromUrl' "data/driving.json" [] , hConcat [ spec1, spec2 ] ] @@@ -3759,8 +3766,8 @@ Assigns a list of specifications to superposed layers in a visualization. @-toVegaLite- [ dataFromUrl "data/driving.json" []+'toVegaLite'+ [ 'dataFromUrl' "data/driving.json" [] , layer [ spec1, spec2 ] ] @@@ -3774,10 +3781,10 @@ Provides an optional name to be associated with the visualization. @-toVegaLite- [ name \"PopGrowth\"- , dataFromUrl "data/population.json" []- , mark Bar []+'toVegaLite'+ [ name "PopGrowth"+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -3794,11 +3801,11 @@ for details. @-toVegaLite- [ width 500- , padding (PEdges 20 10 5 15)- , dataFromUrl "data/population.json" []- , mark Bar []+'toVegaLite'+ [ 'width' 500+ , padding ('PEdges' 20 10 5 15)+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -3816,9 +3823,9 @@ to apply to each of those fields using 'asSpec'. @-toVegaLite- [ repeat [ ColumnFields [ \"Cat\", \"Dog\", \"Fish\" ] ]- , specification (asSpec spec)+'toVegaLite'+ [ repeat [ 'ColumnFields' [ \"Cat\", \"Dog\", \"Fish\" ] ]+ , 'specification' ('asSpec' spec) ] @ @@ -3841,10 +3848,10 @@ @ let res = resolve- . resolution (RLegend [ ( ChColor, Independent ) ])-in toVegaLite- [ dataFromUrl "data/movies.json" []- , vConcat [ heatSpec, barSpec ]+ . 'resolution' ('RLegend' [ ( 'ChColor', 'Independent' ) ])+in 'toVegaLite'+ [ 'dataFromUrl' "data/movies.json" []+ , 'vConcat' [ heatSpec, barSpec ] , res [] ] @@@ -3864,7 +3871,7 @@ <https://vega.github.io/vega-lite/docs/selection.html Vega-Lite documentation>. @-selection = selection . select "view" Interval [ BindScales ]+sel = selection . 'select' "view" 'Interval' [ 'BindScales' ] @ -} selection :: [LabelledSpec] -> (VLProperty, VLSpec)@@ -3876,8 +3883,8 @@ Defines a specification object for use with faceted and repeated small multiples. @-toVegaLite- [ facet [ RowBy [ FName \"Origin\", FmType Nominal ] ]+'toVegaLite'+ [ 'facet' [ 'RowBy' [ 'FName' \"Origin\", 'FmType' 'Nominal' ] ] , specifcation spec ] @@@ -3896,8 +3903,8 @@ @ trans = transform- . filter (FExpr "datum.year == 2010")- . calculateAs "datum.sex == 2 ? 'Female' : 'Male'" "gender"+ . 'filter' ('FExpr' "datum.year == 2010")+ . 'calculateAs' "datum.sex == 2 ? 'Female' : 'Male'" "gender" @ -} @@ -3968,8 +3975,8 @@ Assigns a list of specifications to be juxtaposed vertically in a visualization. @-toVegaLite- [ dataFromUrl "data/driving.json" []+'toVegaLite'+ [ 'dataFromUrl' "data/driving.json" [] , vConcat [ spec1, spec2 ] ] @@@ -3984,10 +3991,10 @@ will be calculated based on the content of the visualization. @-toVegaLite+'toVegaLite' [ width 500- , dataFromUrl "data/population.json" []- , mark Bar []+ , 'dataFromUrl' "data/population.json" []+ , 'mark' 'Bar' [] , enc [] ] @@@ -4006,9 +4013,9 @@ @ trans =- transform+ 'transform' . aggregate- [ opAs Min "people" "lowerBound", opAs Max "people" "upperBound" ]+ [ 'opAs' 'Min' "people" "lowerBound", opAs 'Max' "people" "upperBound" ] [ "age" ] @ -}@@ -4033,8 +4040,8 @@ @ trans =- transform- . binAs [ MaxBins 3 ] \"IMDB_Rating\" "ratingGroup"+ 'transform'+ . binAs [ 'MaxBins' 3 ] \"IMDB_Rating\" "ratingGroup" @ -} binAs ::@@ -4059,8 +4066,7 @@ for further details. @-trans =- transform . calculateAs "datum.sex == 2 ? 'F' : 'M'" "gender"+trans = 'transform' . calculateAs "datum.sex == 2 ? 'F' : 'M'" "gender" @ -} calculateAs ::@@ -4077,14 +4083,14 @@ Encode a color channel. @-color [ MName \"Species\", MmType Nominal ] []+color [ 'MName' \"Species\", 'MmType' 'Nominal' ] [] @ Encoding a color channel will generate a legend by default. To stop the legend appearing, just supply an empty list of legend properties to 'MLegend': @-color [ MName \"Species\", MmType Nominal, MLegend [] ] []+color [ MName \"Species\", MmType Nominal, 'MLegend' [] ] [] @ -} color ::@@ -4102,10 +4108,10 @@ @ enc =- encoding- . position X [ PName "people", PmType Quantitative ]- . position Y [ PName "gender", PmType Nominal ]- . column [ FName "age", FmType Ordinal ]+ 'encoding'+ . 'position' 'X' [ 'PName' "people", 'PmType' 'Quantitative' ]+ . position 'Y' [ PName "gender", PmType 'Nominal' ]+ . column [ 'FName' "age", 'FmType' 'Ordinal' ] @ -} column ::@@ -4125,7 +4131,7 @@ configurations to which this one may be added. @-configuration (Axis [ DomainWidth 4 ]) []+configuration ('Axis' [ 'DomainWidth' 4 ]) [] @ -} configuration :: ConfigurationProperty -> BuildLabelledSpecs@@ -4142,7 +4148,7 @@ for details. @-detail [ DName \"Species\", DmType Nominal ] []+detail [ 'DName' \"Species\", 'DmType' 'Nominal' ] [] @ -} detail :: [DetailChannel] -> BuildLabelledSpecs@@ -4159,7 +4165,7 @@ should be added. @-fill [ MName \"Species\", MmType Nominal ] []+fill [ 'MName' \"Species\", 'MmType' 'Nominal' ] [] @ Note that if both @fill@ and 'color' encodings are specified, @fill@ takes precedence.@@ -4179,8 +4185,8 @@ @ trans =- transform- . filter (FEqual \"Animal\" (Str \"Cat\"))+ 'transform'+ . filter ('FEqual' \"Animal\" ('Str' \"Cat\")) @ Filter operations can combine selections and data predicates with 'BooleanOp'@@ -4189,7 +4195,7 @@ @ trans = transform- . filter (FCompose (And (Expr "datum.Weight_in_lbs > 3000") (Selection "brush")))+ . filter ('FCompose' ('And' ('Expr' "datum.Weight_in_lbs > 3000") ('Selection' "brush"))) @ -} filter :: Filter -> BuildLabelledSpecs@@ -4231,7 +4237,7 @@ this hyperlink channel should be added. @-hyperlink [ HName \"Species\", HmType Nominal ] []+hyperlink [ 'HName' \"Species\", 'HmType' 'Nominal' ] [] @ For further details see the@@ -4262,8 +4268,8 @@ @ trans =- transform- . lookup "person" (dataFromUrl "data/lookup_people.csv" []) "name" [ "age", "height" ]+ 'transform'+ . lookup "person" ('dataFromUrl' "data/lookup_people.csv" []) "name" [ "age", "height" ] @ -} lookup ::@@ -4302,8 +4308,8 @@ file matches the value of @person@ in the primary data source. @-trans = transform- . lookupAs "person" (dataFromUrl "data/lookup_people.csv" []) "name" "personDetails"+trans = 'transform'+ . lookupAs "person" ('dataFromUrl' "data/lookup_people.csv" []) "name" "personDetails" @ -} lookupAs ::@@ -4329,7 +4335,7 @@ is a list of any previous channels to which this opacity channel should be added. @-opacity [ MName \"Age\", MmType Quantitative ] []+opacity [ 'MName' \"Age\", 'MmType' 'Quantitative' ] [] @ -} opacity :: [MarkChannel] -> BuildLabelledSpecs@@ -4345,10 +4351,10 @@ @ enc =- encoding- . position X [ PName "miles", PmType Quantitative ]- . position Y [ PName "gas", PmType Quantitative ]- . order [ OName "year", OmType Temporal ]+ 'encoding'+ . 'position' 'X' [ 'PName' "miles", 'PmType' 'Quantitative' ]+ . position 'Y' [ PName "gas", PmType Quantitative ]+ . order [ 'OName' "year", 'OmType' 'Temporal' ] @ -} order :: [OrderChannel] -> BuildLabelledSpecs@@ -4362,8 +4368,8 @@ @ enc =- encoding- . position X [ PName \"Animal\", PmType Ordinal ]+ 'encoding'+ . position 'X' [ 'PName' \"Animal\", 'PmType' 'Ordinal' ] @ Encoding by position will generate an axis by default. To prevent the axis from@@ -4372,7 +4378,7 @@ @ enc = encoding- . position X [ PName \"Animal\", PmType Ordinal, PAxis [] ]+ . position X [ PName \"Animal\", PmType Ordinal, 'PAxis' [] ] @ -} position ::@@ -4397,8 +4403,8 @@ pairing the channel to which it applies and the rule type. @-resolve- . resolution (RScale [ ( ChY, Independent ) ])+'resolve'+ . resolution ('RScale' [ ( 'ChY', 'Independent' ) ]) @ -} resolution :: Resolve -> BuildLabelledSpecs@@ -4411,10 +4417,10 @@ @ enc =- encoding- . position X [ PName "people", PmType Quantitative ]- . position Y [ PName "gender", PmType Nominal ]- . row [ FName "age", FmType Ordinal ]+ 'encoding'+ . 'position' 'X' [ 'PName' "people", 'PmType' 'Quantitative' ]+ . position 'Y' [ PName "gender", PmType 'Nominal' ]+ . row [ 'FName' "age", 'FmType' 'Ordinal' ] @ -} row ::@@ -4431,10 +4437,10 @@ @ sel =- selection- . select "view" Interval [ BindScales ] []+ 'selection'+ . select "view" 'Interval' [ 'BindScales' ] [] . select "myBrush" Interval []- . select "myPaintbrush" Multi [ On "mouseover", Nearest True ]+ . select "myPaintbrush" 'Multi' [ 'On' "mouseover", 'Nearest' True ] @ -} select ::@@ -4455,7 +4461,7 @@ Encode a shape channel. @-shape [ MName \"Species\", MmType Nominal ] []+shape [ 'MName' \"Species\", 'MmType' 'Nominal' ] [] @ -} shape ::@@ -4470,7 +4476,7 @@ Encode a size channel. @-size [ MName \"Age\", MmType Quantitative ] []+size [ 'MName' \"Age\", 'MmType' 'Quantitative' ] [] @ -} size ::@@ -4486,7 +4492,7 @@ only affects the exterior boundary of marks. @-stroke [ MName \"Species\", MmType Nominal ] []+stroke [ 'MName' \"Species\", 'MmType' 'Nominal' ] [] @ Note that if both @stroke@ and 'color' encodings are specified, @stroke@ takes@@ -4511,9 +4517,9 @@ @ enc =- encoding- . position X [ PName "miles", PmType Quantitative ]- . position Y [ PName "gas", PmType Quantitative ]+ 'encoding'+ . 'position' 'X' [ 'PName' "miles", 'PmType' 'Quantitative' ]+ . position 'Y' [ PName "gas", PmType Quantitative ] . text [ 'TName' "miles", 'TmType' Quantitative ] @ -}@@ -4539,12 +4545,12 @@ grouping by month: @-trans = transform . timeUnitAs Month "date" "monthly"+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 ]+enc = 'encoding'+ . 'position' 'X' [ 'PName' "date", 'PmType' 'Temporal', 'PTimeUnit' 'Day' ]+ . position 'Y' [ 'PAggregate' 'Sum', PmType 'Quantitative' ]+ . 'detail' [ 'DName' "monthly", 'DmType' 'Temporal' ] @ -} timeUnitAs ::@@ -4568,9 +4574,9 @@ for formatting the appearance of the text. @-enc = encoding- . position X [ PName \"Horsepower\", PmType Quantitative ]- . position Y [ PName \"Miles_per_Gallon\", PmType Quantitative ]+enc = 'encoding'+ . 'position' 'X' [ 'PName' \"Horsepower\", 'PmType' 'Quantitative' ]+ . position 'Y' [ PName \"Miles_per_Gallon\", PmType Quantitative ] . tooltip [ 'TName' \"Year\", 'TmType' 'Temporal', 'TFormat' "%Y" ] @ -}@@ -4587,10 +4593,12 @@ The first parameter is a list of the multiple tooltips, each of which is a list of text channel properties that define the channel. +@since 0.3.0.0+ @-enc = encoding- . position X [ PName \"Horsepower\", PmType Quantitative ]- . position Y [ PName \"Miles_per_Gallon\", PmType Quantitative ]+enc = 'encoding'+ . 'position' 'X' [ 'PName' \"Horsepower\", 'PmType' 'Quantitative' ]+ . position 'Y' [ PName \"Miles_per_Gallon\", PmType Quantitative ] . tooltips [ [ 'TName' \"Year\", 'TmType' 'Temporal', 'TFormat' "%Y" ] ,[ TName \"Month\", TmType Temporal, TFormat "%Y" ] ] @