hvega 0.4.1.1 → 0.4.1.2
raw patch · 12 files changed
+38/−65 lines, 12 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Graphics.Vega.Tutorials.VegaLite: skyPlot2 :: VegaLite
Files
- CHANGELOG.md +6/−0
- README.md +2/−2
- hvega.cabal +1/−1
- hvega.nix +3/−1
- src/Graphics/Vega/Tutorials/VegaLite.hs +0/−40
- src/Graphics/Vega/VegaLite.hs +1/−1
- stack.yaml +1/−1
- tests/CompositeTests.hs +3/−0
- tests/DataTests.hs +6/−6
- tests/GeoTests.hs +12/−5
- tests/ViewCompositionTests.hs +3/−7
- tools/PlayTutorial.hs +0/−1
CHANGELOG.md view
@@ -1,6 +1,12 @@ 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.4.1.2++Documentation fix (rendering of a URL), provided by Alexey Kuleshevich+(lehins). The tests should now build without warning in GHC 8.8.1 (CPP+to the rescue again!).+ ## 0.4.1.1 Avoid a build warning about importing <> from Data.Monoid in GHC 8.8.1
README.md view
@@ -13,7 +13,7 @@ [Vega View](https://hackage.haskell.org/package/vega-view) and [Vega-Desktop](https://github.com/vega/vega-desktop). -It is based on an early version (2.2.1) of the+It started off being a copy on an early version (2.2.1) of the [Elm Vega library](http://package.elm-lang.org/packages/gicentre/elm-vega/2.2.1/VegaLite), which is released under a BSD3 license by Jo Wood of the giCentre at the City University of London.@@ -53,7 +53,7 @@ [Vega-Lite Example Gallery](https://vega.github.io/vega-lite/examples/) has been converted to an [IHaskell notebook](https://github.com/DougBurke/hvega/blob/master/notebooks/VegaLiteGallery.ipynb)-Uunfortunately the plots created by VegaEmbed **do not always appear**+Unfortunately the plots created by VegaEmbed **do not always appear** in the notebook when viewed with either GitHub's viewer or [ipynb viewer](http://nbviewer.jupyter.org/github/DougBurke/hvega/blob/master/notebooks/VegaLiteGallery.ipynb), but things seem much better when using Jupyter Lab (rather than
hvega.cabal view
@@ -1,5 +1,5 @@ name: hvega-version: 0.4.1.1+version: 0.4.1.2 synopsis: Create Vega-Lite visualizations (version 3) in Haskell. description: This is based on the elm-vegalite package (<http://package.elm-lang.org/packages/gicentre/elm-vegalite/latest>)
hvega.nix view
@@ -4,8 +4,10 @@ }: mkDerivation { pname = "hvega";- version = "0.4.0.0";+ version = "0.4.1.2"; src = ./.;+ isLibrary = true;+ isExecutable = true; libraryHaskellDepends = [ aeson base text unordered-containers vector ];
src/Graphics/Vega/Tutorials/VegaLite.hs view
@@ -123,7 +123,6 @@ , posPlot , skyPlot- , skyPlot2 -- DEBUG -- * Layered and Multi-View Compositions --@@ -1321,45 +1320,6 @@ , trans [] , mark Circle [] , enc []- ]--skyPlot2 :: VegaLite-skyPlot2 =- let enc = encoding- . position Longitude (axOpts "fakeLongitude")- . position Latitude (axOpts "DE_ICRS")- . color [ MName "plx"- , MmType Quantitative- , MScale [ SType ScLog- , SScheme "viridis" []- ]- ]- . tooltip [ TName "Cluster", TmType Nominal ]- - axOpts field = [ PName field, PmType Quantitative ]- - trans = transform- . calculateAs "180 - datum.RA_ICRS" "fakeLongitude"-- spec1 = [ gaiaData- , trans []- , enc []- , mark Circle []- ]-- -- depending on how we view it, may need to specify mark- -- options (ie "mark Geoshape []" should be enough but- -- vega-view doesn't show anything for some reason, but- -- the vega editor does)- --- spec2 = [ graticule [ GrStepMinor (45, 20) ]- , mark Geoshape [ MFilled False, MStrokeWidth 0.3 ]- ]- - in toVegaLite [ projection [ PrType Mercator- , PrCenter 0 0- ]- , layer [ asSpec spec1, asSpec spec2 ] ] -- $intro-layered
src/Graphics/Vega/VegaLite.hs view
@@ -79,7 +79,7 @@ @ > 'A.encode' $ 'fromVL' vl1-> "{\"mark\":{\"color\":\"teal\",\"opacity\":0.4,\"type\":\"bar\"},\"data\":{\"values\":[{\"start\":\"2011-03-25\",\"count\":23},{\"start\":\"2011-04-02\",\"count\":45},{\"start\":\"2011-04-12\",\"count\":3}],\"format\":{\"parse\":{\"start\":\"date:'%Y-%m-%d'\"}}},\"$schema\":\"https://vega.github.io/schema/vega-lite/v3.json\",\"encoding\":{\"x\":{\"field\":\"start\",\"type\":\"temporal\",\"axis\":{\"title\":\"Inception date\"}},\"y\":{\"field\":\"count\",\"type\":\"quantitative\"}},\"background\":\"white\",\"description\":\"A very exciting bar chart\"}"+> "{\"mark\":{\"color\":\"teal\",\"opacity\":0.4,\"type\":\"bar\"},\"data\":{\"values\":[{\"start\":\"2011-03-25\",\"count\":23},{\"start\":\"2011-04-02\",\"count\":45},{\"start\":\"2011-04-12\",\"count\":3}],\"format\":{\"parse\":{\"start\":\"date:'%Y-%m-%d'\"}}},\"$schema\":\"https:\/\/vega.github.io\/schema\/vega-lite\/v3.json\",\"encoding\":{\"x\":{\"field\":\"start\",\"type\":\"temporal\",\"axis\":{\"title\":\"Inception date\"}},\"y\":{\"field\":\"count\",\"type\":\"quantitative\"}},\"background\":\"white\",\"description\":\"A very exciting bar chart\"}" @ The produced JSON can then be processed with vega-lite, which renders the following image:
stack.yaml view
@@ -5,4 +5,4 @@ extra-deps: [] -resolver: lts-14.7+resolver: lts-14.18
tests/CompositeTests.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} --@@ -7,7 +8,9 @@ import qualified Data.Text as T +#if !(MIN_VERSION_base(4, 12, 0)) import Data.Monoid ((<>))+#endif import Graphics.Vega.VegaLite
tests/DataTests.hs view
@@ -268,13 +268,13 @@ dvals = dataFromJson (A.toJSON (map A.object- [ [ ( "key" .= ("alpha" :: String) )- , ( "foo" .= [ 1 :: Int, 2 ] )- , ( "bar" .= [ "A" :: String, "B" ] )+ [ [ "key" .= ("alpha" :: String)+ , "foo" .= [ 1 :: Int, 2 ]+ , "bar" .= [ "A" :: String, "B" ] ]- , [ ( "key" .= ("beta" :: String) )- , ( "foo" .= [ 3 :: Int, 4, 5 ] )- , ( "bar" .= [ "C" :: String, "D" ] )+ , [ "key" .= ("beta" :: String)+ , "foo" .= [ 3 :: Int, 4, 5 ]+ , "bar" .= [ "C" :: String, "D" ] ] ]) )
tests/GeoTests.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} --@@ -7,7 +8,9 @@ import qualified Data.Text as T +#if !(MIN_VERSION_base(4, 12, 0)) import Data.Monoid ((<>))+#endif import Graphics.Vega.VegaLite @@ -63,7 +66,7 @@ defaultSize2 = toVegaLite [ description "Default map size with view width and height specified in config."- , configure $ configuration (View [ ViewWidth 500, ViewHeight 300 ]) $ []+ , configure $ configuration (View [ ViewWidth 500, ViewHeight 300 ]) [] , projection [ PrType AlbersUsa ] , dataFromUrl "https://vega.github.io/vega-lite/data/us-10m.json" [ TopojsonFeature "counties" ] , mark Geoshape []@@ -442,7 +445,7 @@ asSpec [ width 300, height 300, projection [ PrType Orthographic ], layer [ graticuleSpec, countrySpec ] ] in toVegaLite- [ configure $ configuration (View [ ViewStroke Nothing ]) $ []+ [ configure $ configuration (View [ ViewStroke Nothing ]) [] , hConcat [ globe, globe, globe ] ] @@ -473,7 +476,9 @@ asSpec [ layer [ graticuleSpec, countrySpec ] ] in toVegaLite- [ configure $ configuration (View [ ViewStroke Nothing ]) $ [], hConcat [ rotatedSpec (-65), rotatedSpec 115, rotatedSpec (-65) ] ]+ [ configure $ configuration (View [ ViewStroke Nothing ]) []+ , hConcat [ rotatedSpec (-65), rotatedSpec 115, rotatedSpec (-65) ]+ ] mapComp4 :: VegaLite@@ -511,7 +516,9 @@ asSpec [ layer [ seaSpec, graticuleSpec, countrySpec ] ] in toVegaLite- [ configure $ configuration (View [ ViewStroke Nothing ]) $ [], hConcat [ rotatedSpec 0, rotatedSpec (-40) ] ]+ [ configure $ configuration (View [ ViewStroke Nothing ]) []+ , hConcat [ rotatedSpec 0, rotatedSpec (-40) ]+ ] dotMap1 :: VegaLite@@ -530,7 +537,7 @@ , height 300 , projection [ PrType AlbersUsa ] , dataFromUrl "https://vega.github.io/vega-lite/data/zipcodes.csv" []- , transform $ calculateAs "substring(datum.zip_code, 0, 1)" "digit" $ []+ , transform $ calculateAs "substring(datum.zip_code, 0, 1)" "digit" [] , mark Circle [] , enc [] ]
tests/ViewCompositionTests.hs view
@@ -78,21 +78,17 @@ ] [] --- is this in the prelude-repeatN :: Int -> a -> [a]-repeatN n = take n . P.repeat- dataVals :: [DataColumn] -> Data dataVals = let rows =- Numbers $ concatMap (repeatN (3 * 5)) [ 1, 2, 3, 4 ]+ Numbers $ concatMap (P.replicate (3 * 5)) [ 1, 2, 3, 4 ] cols =- Numbers $ concat $ repeatN 4 $ concatMap (repeatN 3) [ 1, 2, 3, 4, 5 ]+ Numbers $ concat $ P.replicate 4 $ concatMap (P.replicate 3) [ 1, 2, 3, 4, 5 ] cats =- Numbers $ concat $ repeatN (4 * 5) [ 1, 2, 3 ]+ Numbers $ concat $ P.replicate (4 * 5) [ 1, 2, 3 ] vals = Numbers $ [ 30, 15, 12, 25, 30, 25, 10, 28, 11, 18, 24, 16, 10, 10, 10 ]
tools/PlayTutorial.hs view
@@ -100,7 +100,6 @@ , ("pointplot", VL.pointPlot) , ("posplot", VL.posPlot) , ("skyplot", VL.skyPlot)- , ("skyplot2", VL.skyPlot2) , ("smallmultiples", VL.smallMultiples) , ("smallmultiples2", VL.smallMultiples2) , ("baseplot", VL.basePlot)