hvega 0.7.0.1 → 0.8.0.0
raw patch · 34 files changed
+1022/−52 lines, 34 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Graphics.Vega.VegaLite: LeTitle :: Text -> LegendConfig
- Graphics.Vega.VegaLite: ScBinLinear :: Scale
+ Graphics.Vega.VegaLite: Disable :: Bool -> AxisConfig
+ Graphics.Vega.VegaLite: HLabelBaseline :: VAlign -> HeaderProperty
+ Graphics.Vega.VegaLite: HLabelFontWeight :: FontWeight -> HeaderProperty
+ Graphics.Vega.VegaLite: HLabelLineHeight :: Double -> HeaderProperty
+ Graphics.Vega.VegaLite: HOrient :: Side -> HeaderProperty
+ Graphics.Vega.VegaLite: LLabelExpr :: VegaExpr -> LegendProperty
+ Graphics.Vega.VegaLite: LSymbolLimit :: Int -> LegendProperty
+ Graphics.Vega.VegaLite: LTitleLineHeight :: Double -> LegendProperty
+ Graphics.Vega.VegaLite: LeDirection :: Orientation -> LegendConfig
+ Graphics.Vega.VegaLite: LeDisable :: Bool -> LegendConfig
- Graphics.Vega.VegaLite: HTitleFontWeight :: Text -> HeaderProperty
+ Graphics.Vega.VegaLite: HTitleFontWeight :: FontWeight -> HeaderProperty
Files
- CHANGELOG.md +36/−0
- README.md +2/−2
- hvega.cabal +1/−1
- src/Graphics/Vega/Tutorials/VegaLite.hs +1/−1
- src/Graphics/Vega/VegaLite.hs +41/−1
- src/Graphics/Vega/VegaLite/Configuration.hs +39/−9
- src/Graphics/Vega/VegaLite/Core.hs +6/−2
- src/Graphics/Vega/VegaLite/Foundation.hs +88/−30
- src/Graphics/Vega/VegaLite/Legend.hs +25/−1
- tests/ConfigTests.hs +4/−1
- tests/LegendTests.hs +13/−0
- tests/ShapeTests.hs +8/−2
- tests/ViewCompositionTests.hs +48/−2
- tests/specs/config/dark.vl +1/−0
- tests/specs/config/vbTest.vl +3/−0
- tests/specs/legend/corners2.vl +6/−0
- tests/specs/legend/disablelegend.vl +36/−0
- tests/specs/shape/isotype1.vl +3/−0
- tests/specs/viewcomposition/columns4.vl +4/−0
- tests/specs/viewcomposition/grid1.vl +3/−0
- tests/specs/viewcomposition/grid2.vl +3/−0
- tests/specs/viewcomposition/grid3.vl +3/−0
- tests/specs/viewcomposition/lorientbottomcnf.vl +54/−0
- tests/specs/viewcomposition/lorientbottomhdr.vl +54/−0
- tests/specs/viewcomposition/lorientrightcnf.vl +54/−0
- tests/specs/viewcomposition/lorientrighthdr.vl +54/−0
- tests/specs/viewcomposition/orientbottomcnf.vl +54/−0
- tests/specs/viewcomposition/orientbottomhdr.vl +54/−0
- tests/specs/viewcomposition/orientrightcnf.vl +54/−0
- tests/specs/viewcomposition/orientrighthdr.vl +54/−0
- tests/specs/viewcomposition/torientbottomcnf.vl +54/−0
- tests/specs/viewcomposition/torientbottomhdr.vl +54/−0
- tests/specs/viewcomposition/torientrightcnf.vl +54/−0
- tests/specs/viewcomposition/torientrighthdr.vl +54/−0
CHANGELOG.md view
@@ -1,6 +1,42 @@ 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.8.0.0++The Vega-Lite tests are now validated against version 4.8 of the+Vega-Lite schema.++The `RepeatStyle` constructor for `ConfigurationProperty` should not+be used, as its functionality has been moved to `ConcatStyle` in+Vega-Lite 4.8. This constructor will be removed at some point in the+future but is still available (as support for Vega-Lite 4.8 is+limited).++### Breaking Changes++The `HTitleFontWeight` constructor (a member of `HeaderProperty`)+now takes a `FontWeight` argument rather than `Text`.++The `LeTitle` constructor from `LegendConfig` was removed as it is not+supported in Vega-Lite (`LeNoTitle` remains, as it is used to remove+legend titles from a visualization).++`ScBinLinear` was removed from `Scale` as it is not used by Vega-Lite.++### New constructors++The `HeaderProperty` type has gained the following constructors from+Vega-Lite 4.8: `HLabelBaseline`, `HLabelFontWeight`,+`HLabelLineHeight`, and `HOrient`.++The `AxisConfig` type has gained the `Disable` constructor from+Vega-Lite 4.8.++The `LegendConfig` type has gained the `LeDirection` and (from+Vega-Lite 4.8) `LeDisable` constructors. The `LegendProperty` type has+gained `LLabelExpr`, `LSymbolLimit`, and `LTitleLineHeight`+constructors.+ ## 0.7.0.1 Minor documentation fixes (typos and fixing links).
README.md view
@@ -1,9 +1,9 @@ # hvega -[](https://vega.github.io/vega-lite/)+[](https://vega.github.io/vega-lite/) Create [Vega-Lite](https://vega.github.io/vega-lite/) visualizations in-Haskell. It targets version 4.7 of the Vega-Lite specification. Note that+Haskell. It targets version 4.8 of the Vega-Lite specification. Note that the module does not include a viewer for these visualizations (which are JSON files), but does provide several helper functions, such as [toHtmlFile](https://hackage.haskell.org/package/hvega/docs/Graphics-Vega-VegaLite.html#v:toHtmlFile),
hvega.cabal view
@@ -1,5 +1,5 @@ name: hvega-version: 0.7.0.1+version: 0.8.0.0 synopsis: Create Vega-Lite visualizations (version 4) in Haskell. description: This is based on the elm-vegalite package (<http://package.elm-lang.org/packages/gicentre/elm-vegalite/latest>)
src/Graphics/Vega/Tutorials/VegaLite.hs view
@@ -300,7 +300,7 @@ -- -- [@Scale@]: Descriptions of the way encoded marks represent the data. Example settings: 'SDomain', 'SPadding', and 'SInterpolate'. ----- [@Guides@]: Supplementary visual elements that support interpreting the visualization. Example setings: 'AxDomain' (for position encodings) and 'LeTitle' (for legend color, size, and shape encodings).+-- [@Guides@]: Supplementary visual elements that support interpreting the visualization. Example setings: 'AxDomain' (for position encodings) and 'LeTitleColor' (for legend color, size, and shape encodings). -- -- In common with other languages that build upon a grammar of graphics -- such as D3 and Vega, this grammar allows fine grain control of
src/Graphics/Vega/VegaLite.hs view
@@ -14,7 +14,7 @@ it has been updated to match later versions. This module allows users to create a Vega-Lite specification, targeting __version 4__ of the <https://vega.github.io/schema/vega-lite/v4.json JSON schema>.-Version 0.7 of @hvega@ supports version 4.7 of the Vega-Lite specification.+Version 0.8 of @hvega@ supports version 4.8 of the Vega-Lite specification. Although this is based on the Elm module, there are differences, such as using type constructors rather than functions for many properties -@@ -807,6 +807,10 @@ -- -- $update + -- ** Version 0.8+ --+ -- $update0800+ -- ** Version 0.7 -- -- $update0700@@ -1198,6 +1202,42 @@ -- $update -- The following section describes how to update code that used -- an older version of @hvega@.++-- $update0800+-- The @0.8.0.0@ release updates @hvega@ to support version 4.8 of+-- the Vega-Lite schema.+--+-- The 'VL.RepeatStyle' constructor for 'VL.ConfigurationProperty' should not+-- be used, as its functionality has been moved to 'VL.ConcatStyle' in+-- Vega-Lite 4.8. This constructor will be removed at some point in the+-- future but is still available (as support for Vega-Lite 4.8 is+-- limited).+--+-- __Breaking Changes__+--+-- The 'VL.HTitleFontWeight' constructor (a member of 'VL.HeaderProperty')+-- now takes a 'VL.FontWeight' argument rather than @Text@.+--+-- The @LeTitle@ constructor from 'VL.LegendConfig' was removed as it+-- is not supported in Vega-Lite ('VL.LeNoTitle' remains, as it is used+-- to remove legend titles from a visualization).+--+-- @ScBinLinear@ was removed from 'VL.Scale' as it is+-- not used by Vega-Lite.+--+-- __New constructors__+--+-- The 'VL.HeaderProperty' type has gained the following constructors+-- from Vega-Lite 4.8: 'VL.HLabelBaseline', 'VL.HLabelFontWeight',+-- 'VL.HLabelLineHeight', and 'VL.HOrient'.+--+-- The 'VL.AxisConfig' type has gained the 'VL.Disable' constructor from+-- Vega-Lite 4.8.+--+-- The 'VL.LegendConfig' type has gained the 'VL.LeDirection' and+-- (from Vega-Lite 4.8) 'VL.LeDisable' constructors. The 'VL.LegendProperty'+-- type has gained 'VL.LLabelExpr', 'VL.LSymbolLimit', and+-- 'VL.LTitleLineHeight' constructors. -- $update0700 -- The @0.7.0.0@ release updates @hvega@ to support version 4.7 of
src/Graphics/Vega/VegaLite/Configuration.hs view
@@ -263,11 +263,17 @@ | CircleStyle [MarkProperty] -- ^ The default appearance of circle marks. | ConcatStyle [CompositionConfig]- -- ^ The default appearance of concatenated layouts.+ -- ^ The default appearance for all concatenation and repeat view+ -- composition operators ('Graphics.Vega.VegaLite.vlConcat',+ -- 'Graphics.Vega.VegaLite.hConcat', 'Graphics.Vega.VegaLite.vConcat',+ -- and 'Graphics.Vega.VegaLite.repeat`). -- -- In @0.6.0.0@ this was changed from accepting @ConcatConfig@ to -- 'CompositionConfig'. --+ -- Vega-Lite 4.8 changed this field to also control repeat-view+ -- operators (which previously had used @RepeatStyle@).+ -- -- @since 0.4.0.0 | CountTitleStyle T.Text -- ^ The default axis and legend title for count fields. The default is@@ -384,9 +390,14 @@ -- @since 0.6.0.0 | RectStyle [MarkProperty] -- ^ The default appearance of rectangle marks.- | RepeatStyle [CompositionConfig]+ | RepeatStyle [CompositionConfig] -- TODO: remove -- ^ The default appearance for the 'Graphics.Vega.VegaLite.repeat` operator. --+ -- Support for this setting was removed in Vega-Lite 4.8. This+ -- constructor is currently still supported, but will be removed+ -- in a future release. The 'ConcatStyle' option should be+ -- used instead.+ -- -- @since 0.6.0.0 | RuleStyle [MarkProperty] -- ^ The default appearance of rule marks.@@ -686,6 +697,10 @@ For more detail see the <https://vega.github.io/vega-lite/docs/legend.html#config Vega-Lite documentation>. +In @0.8.0.0@ the @LeTitle@ constructor was removed as there is no way+to set the default text for a legend title in Vega-Lite ('LeNoTitle'+remains as this is used to turn off legend titles).+ In @0.6.0.0@ the following constructors were added (all from Vega-Lite 4.0): 'LeSymbolLimit', 'LeTickCount', 'LeTitleLineHeight', and 'LeUnselectedOpacity'.@@ -724,6 +739,16 @@ -- @since 0.4.0.0 | LeCornerRadius Double -- ^ The corner radius for the full legend.+ | LeDirection Orientation+ -- ^ The direction for the legend.+ --+ -- @since 0.8.0.0+ | LeDisable Bool+ -- ^ Disable the legend by default?+ --+ -- Added in Vega-Lite 4.8.+ --+ -- @since 0.8.0.0 | LeFillColor Color -- ^ The background fill color for the full legend. | LeGradientDirection Orientation@@ -829,7 +854,8 @@ -- ^ The offset in pixels between the legend and the data rectangle -- and axes. | LeOrient LegendOrientation- -- ^ The orientation of the legend.+ -- ^ The orientation of the legend, which determines how the legend is positioned+ -- within the scene. | LePadding Double -- ^ The padding between the border and content of the legend group. | LeRowPadding Double@@ -895,12 +921,8 @@ -- ^ The desired number of tick values for quantitative legends -- -- @since0.6.0.0- | LeTitle T.Text- -- ^ The legend title.- --- -- @since 0.4.0.0 | LeNoTitle- -- ^ Draw no title for the legend.+ -- ^ Do not add a title for the legend. -- -- @since 0.4.0.0 | LeTitleAlign HAlign@@ -951,6 +973,8 @@ legendConfigProperty (LeColumnPadding x) = "columnPadding" .= x legendConfigProperty (LeColumns n) = "columns" .= n legendConfigProperty (LeCornerRadius x) = "cornerRadius" .= x+legendConfigProperty (LeDirection o) = "direction" .= orientationSpec o+legendConfigProperty (LeDisable b) = "disable" .= b legendConfigProperty (LeFillColor s) = "fillColor" .= fromColor s legendConfigProperty (LeGradientDirection o) = "gradientDirection" .= orientationSpec o legendConfigProperty (LeGradientHorizontalMaxLength x) = "gradientHorizontalMaxLength" .= x@@ -1002,7 +1026,6 @@ legendConfigProperty (LeSymbolStrokeWidth x) = "symbolStrokeWidth" .= x legendConfigProperty (LeSymbolType s) = "symbolType" .= symbolLabel s legendConfigProperty (LeTickCount n) = "tickCount" .= n-legendConfigProperty (LeTitle s) = "title" .= s legendConfigProperty LeNoTitle = "title" .= A.Null legendConfigProperty (LeTitleAlign ha) = "titleAlign" .= hAlignLabel ha legendConfigProperty (LeTitleAnchor anc) = "titleAnchor" .= anchorLabel anc@@ -1256,6 +1279,12 @@ -- @since 0.6.0.0 | BandPosition Double -- ^ The default axis band position.+ | Disable Bool+ -- ^ Disable the axis?+ --+ -- Added in Vega-Lite 4.8.0.+ --+ -- @since 0.8.0.0 | Domain Bool -- ^ Should the axis domain be displayed? | DomainColor Color@@ -1490,6 +1519,7 @@ axisConfigProperty (AStyle s) = "style" .= s axisConfigProperty (BandPosition x) = "bandPosition" .= x+axisConfigProperty (Disable b) = "disable" .= b axisConfigProperty (Domain b) = "domain" .= b axisConfigProperty (DomainColor c) = "domainColor" .= fromColor c axisConfigProperty (DomainDash ds) = "domainDash" .= fromDS ds
src/Graphics/Vega/VegaLite/Core.hs view
@@ -748,10 +748,10 @@ -- -- @since 0.6.0.0 | SRound Bool- -- ^ Are numeric values in a scaling are rounded to integers?+ -- ^ Are numeric values in a scaling rounded to integers? -- -- The default is @False@.- | SScheme T.Text [Double]+ | SScheme T.Text [Double] -- TODO: review this; what is #/definitions/SchemeParams? -- ^ Color scheme used by a color scaling. The first parameter is the -- name of the scheme (e.g. \"viridis\") and the second an optional -- specification, which can contain 1, 2, or 3 numbers:@@ -759,6 +759,10 @@ -- - the number of colors to use (list of one number); -- - the extent of the color range to use (list of two numbers between 0 and 1); -- - the number of colors and extent (three numbers, first is the number of colors).+ --+ -- For the full list of supported schemes, please refer to the+ -- <https://vega.github.io/vega/docs/schemes/#reference Vega Scheme>+ -- reference. -- -- The number of colors was broken prior to @0.4.0.0@ and the option to -- define both the count and extent was added in @0.4.0.0@.
src/Graphics/Vega/VegaLite/Foundation.hs view
@@ -472,7 +472,8 @@ The orientation of an item. This is used with: 'Graphics.Vega.VegaLite.BLeLDirection', 'Graphics.Vega.VegaLite.LDirection',-'Graphics.Vega.VegaLite.LeGradientDirection', 'Graphics.Vega.VegaLite.LeLDirection', 'Graphics.Vega.VegaLite.LeSymbolDirection',+'Graphics.Vega.VegaLite.LeDirection', 'Graphics.Vega.VegaLite.LeGradientDirection',+'Graphics.Vega.VegaLite.LeLDirection', 'Graphics.Vega.VegaLite.LeSymbolDirection', and 'Graphics.Vega.VegaLite.MOrient'. In @0.4.0.0@ this was renamed from @MarkOrientation@ to 'Orientation'.@@ -681,42 +682,58 @@ strokeJoinLabel JBevel = "bevel" --- | Used to indicate the type of scale transformation to apply.------ The @0.4.0.0@ release removed the @ScSequential@ constructor, as--- 'ScLinear' should be used instead.+{-|+Used to indicate the type of scale transformation to apply.+The <https://vega.github.io/vega-lite/docs/scale.html#type Vega-Lite scale documentation>+defines which of these are for continuous or discrete distributions,+and what the defaults are for the combination of data type and+encoding channel. +The 'Scale' type is used with the 'Graphics.Vega.VegaLite.SType'+constructor to set up the scaling properties of an encoding.+Examples:++@+'Graphics.Vega.VegaLite.PScale' [ 'Graphics.Vega.VegaLite.SType' ScTime ]+'Graphics.Vega.VegaLite.color' [ 'Graphics.Vega.VegaLite.MName' \"Acceleration\"+ , 'Graphics.Vega.VegaLite.MmType' 'Quantitative'+ , 'Graphics.Vega.VegaLite.MScale' [ 'Graphics.Vega.VegaLite.SType' ScLog, 'Graphics.Vega.VegaLite.SRange' ('Graphics.Vega.VegaLite.RStrings' [\"yellow\", \"red\"]) ]+ ]+@++The @ScBinLinear@ constructor was removed in @0.8.0.0@ because+it was not used by Vega-Lite.++The @0.4.0.0@ release removed the @ScSequential@ constructor, as+'ScLinear' should be used instead.++-}++-- #/definitions/ScaleType+ data Scale = ScLinear -- ^ A linear scale.+ | ScLog+ -- ^ A log scale. Defaults to log of base 10, but can be customised with+ -- 'Graphics.Vega.VegaLite.SBase'. | ScPow -- ^ A power scale. The exponent to use for scaling is specified with -- 'Graphics.Vega.VegaLite.SExponent'. | ScSqrt -- ^ A square-root scale.- | ScLog- -- ^ A log scale. Defaults to log of base 10, but can be customised with- -- 'Graphics.Vega.VegaLite.SBase'. | ScSymLog -- ^ A [symmetrical log (PDF link)](https://www.researchgate.net/profile/John_Webber4/publication/233967063_A_bi-symmetric_log_transformation_for_wide-range_data/links/0fcfd50d791c85082e000000.pdf) -- scale. Similar to a log scale but supports zero and negative values. The slope -- of the function at zero can be set with 'Graphics.Vega.VegaLite.SConstant'. -- -- @since 0.4.0.0+ -- | ScIdentity added in Vega-Lite 4.4, no documentation+ -- | ScSequential added in Vega-Lite 4.4, no documentation, not clear if any different from linear | ScTime -- ^ A temporal scale. | ScUtc -- ^ A temporal scale, in UTC.- | ScOrdinal- -- ^ An ordinal scale.- | ScBand- -- ^ A band scale.- | ScPoint- -- ^ A point scale.- | ScBinLinear- -- ^ A linear band scale.- | ScBinOrdinal- -- ^ An ordinal band scale. | ScQuantile -- ^ A quantile scale. --@@ -729,24 +746,31 @@ -- ^ A threshold scale. -- -- @since 0.4.0.0+ | ScBinOrdinal+ -- ^ An ordinal band scale.+ | ScOrdinal+ -- ^ An ordinal scale.+ | ScPoint+ -- ^ A point scale.+ | ScBand+ -- ^ A band scale. scaleLabel :: Scale -> T.Text scaleLabel ScLinear = "linear"+scaleLabel ScLog = "log" scaleLabel ScPow = "pow" scaleLabel ScSqrt = "sqrt"-scaleLabel ScLog = "log" scaleLabel ScSymLog = "symlog" scaleLabel ScTime = "time" scaleLabel ScUtc = "utc"-scaleLabel ScOrdinal = "ordinal"-scaleLabel ScBand = "band"-scaleLabel ScPoint = "point"-scaleLabel ScBinLinear = "bin-linear"-scaleLabel ScBinOrdinal = "bin-ordinal" scaleLabel ScQuantile = "quantile" scaleLabel ScQuantize = "quantize" scaleLabel ScThreshold = "threshold"+scaleLabel ScBinOrdinal = "bin-ordinal"+scaleLabel ScOrdinal = "ordinal"+scaleLabel ScPoint = "point"+scaleLabel ScBand = "band" -- | How should the field be sorted when performing a window transform.@@ -1492,6 +1516,13 @@ -- and -90 for row headers. -- -- @since 0.4.0.0+ | HLabelBaseline VAlign+ -- ^ The vertical text baseline for header labels. The default is+ -- 'AlignBaseline'.+ --+ -- Added in Vega-Lite 4.8.0.+ --+ -- @since 0.8.0.0 | HLabelColor Color -- ^ The color of the labels. --@@ -1515,18 +1546,38 @@ -- ^ The font style for the labels. -- -- @since 0.6.0.0+ | HLabelFontWeight FontWeight+ -- ^ The font weight for the header label.+ --+ -- Added in Vega-Lite 4.8.0.+ --+ -- @since 0.8.0.0 | HLabelLimit Double -- ^ The maximum length of each label. -- -- @since 0.4.0.0+ | HLabelLineHeight Double+ -- ^ The line height, in pixels, for multi-line header labels, or+ -- title text with baselines of 'AlignLineTop' or 'AlignLineBottom'.+ --+ -- Added in Vega-Lite 4.8.0.+ --+ -- @since 0.8.0.0 | HLabelOrient Side- -- ^ The position of the label relative to its sub-plot.+ -- ^ The position of the label relative to its sub-plot. See also+ -- 'HOrient'. -- -- @since 0.4.0.0 | HLabelPadding Double -- ^ The spacing in pixels between the label and its sub-plot. -- -- @since 0.4.0.0+ | HOrient Side+ -- ^ A shortcut for setting both 'HLabelOrient' and 'HTitleOrient'.+ --+ -- Since Vega-Lite 4.8.+ --+ -- @since 0.8.0.0 | HTitle T.Text -- ^ The title for the facets. | HNoTitle@@ -1565,20 +1616,23 @@ -- ^ The font style for the title. -- -- @since 0.6.0.0- | HTitleFontWeight T.Text+ | HTitleFontWeight FontWeight -- ^ The font weight for the title. --- -- @since 0.4.0.0+ -- The argument changed from 'T.Text' in @0.8.0.0@.+ --+ -- @since 0.4.0.0 | HTitleLimit Double -- ^ The maximum length of the title. -- -- @since 0.4.0.0 | HTitleLineHeight Double- -- ^ The line height, in pixels, for multi-line title text.+ -- ^ The line height, in pixels, for multi-line header title text, or+ -- title text with baselines of 'AlignLineTop' or 'AlignLineBottom'. -- -- @since 0.6.0.0 | HTitleOrient Side- -- ^ The position of the title relative to the sub-plots.+ -- ^ The position of the title relative to the sub-plots. See also 'HOrient'. -- -- @since 0.4.0.0 | HTitlePadding Double@@ -1597,21 +1651,25 @@ headerProperty (HLabelAlign ha) = "labelAlign" .= hAlignLabel ha headerProperty (HLabelAnchor a) = "labelAnchor" .= anchorLabel a headerProperty (HLabelAngle x) = "labelAngle" .= x+headerProperty (HLabelBaseline va) = "labelBaseline" .= vAlignLabel va headerProperty (HLabelColor s) = "labelColor" .= fromColor s headerProperty (HLabelExpr s) = "labelExpr" .= s headerProperty (HLabelFont s) = "labelFont" .= s headerProperty (HLabelFontSize x) = "labelFontSize" .= x headerProperty (HLabelFontStyle s) = "labelFontStyle" .= s+headerProperty (HLabelFontWeight w) = "labelFontWeight" .= fontWeightSpec w headerProperty (HLabelLimit x) = "labelLimit" .= x+headerProperty (HLabelLineHeight x) = "labelLineHeight" .= x headerProperty (HLabelOrient orient) = "labelOrient" .= sideLabel orient headerProperty (HLabelPadding x) = "labelPadding" .= x+headerProperty (HOrient orient) = "orient" .= sideLabel orient headerProperty (HTitleAlign ha) = "titleAlign" .= hAlignLabel ha headerProperty (HTitleAnchor a) = "titleAnchor" .= anchorLabel a headerProperty (HTitleAngle x) = "titleAngle" .= x headerProperty (HTitleBaseline va) = "titleBaseline" .= vAlignLabel va headerProperty (HTitleColor s) = "titleColor" .= fromColor s headerProperty (HTitleFont s) = "titleFont" .= s-headerProperty (HTitleFontWeight s) = "titleFontWeight" .= s+headerProperty (HTitleFontWeight fw) = "titleFontWeight" .= fontWeightSpec fw headerProperty (HTitleFontSize x) = "titleFontSize" .= x headerProperty (HTitleFontStyle s) = "titleFontStyle" .= s headerProperty (HTitleLimit x) = "titleLimit" .= x
src/Graphics/Vega/VegaLite/Legend.hs view
@@ -48,6 +48,7 @@ , Side , Symbol , VAlign+ , VegaExpr , ZIndex , anchorLabel , boundsSpec@@ -223,6 +224,8 @@ -} +-- based on schema #/definitions/Legend+ data LegendProperty = LClipHeight Double -- ^ The height, in pixels, to clip symbol legend entries.@@ -295,7 +298,16 @@ | LLabelBaseline VAlign -- ^ @since 0.4.0.0 | LLabelColor Color- -- ^ @since 0.4.0.0+ -- ^ The color of the legend label.+ --+ -- @since 0.4.0.0+ | LLabelExpr VegaExpr+ -- ^ Customize the legend label. The default text and value can be accessed+ -- with the @datum.label@ and @datum.value@ expressions.+ --+ -- @LLabelExpr \"\'\<\' + datum.label + \'\>\'\"@+ --+ -- @since 0.8.0.0 | LLabelFont T.Text -- ^ @since 0.4.0.0 | LLabelFontSize Double@@ -344,6 +356,11 @@ -- ^ The fill color of the legend symbol. -- -- @since 0.4.0.0+ | LSymbolLimit Int -- TODO: use a Natural?+ -- ^ The maximum numbed of entries to show in the legend. Additional entries+ -- are dropped.+ --+ -- @since 0.8.0.0 | LSymbolOffset Double -- ^ The horizontal pixel offset for legend symbols. --@@ -398,6 +415,10 @@ -- ^ The maximum allowed pixel width of the legend title. -- -- @since 0.4.0.0+ | LTitleLineHeight Double+ -- ^ The line height, in pixels, for multi-line title text.+ --+ -- @since 0.8.0.0 | LTitleOpacity Opacity -- ^ Opacity of the legend title. --@@ -444,6 +465,7 @@ legendProperty (LLabelAlign ha) = "labelAlign" .= hAlignLabel ha legendProperty (LLabelBaseline va) = "labelBaseline" .= vAlignLabel va legendProperty (LLabelColor s) = "labelColor" .= fromColor s+legendProperty (LLabelExpr s) = "labelExpr" .= s legendProperty (LLabelFont s) = "labelFont" .= s legendProperty (LLabelFontSize x) = "labelFontSize" .= x legendProperty (LLabelFontStyle s) = "labelFontStyle" .= s@@ -463,6 +485,7 @@ legendProperty (LSymbolDash ds) = "symbolDash" .= fromDS ds legendProperty (LSymbolDashOffset x) = "symbolDashOffset" .= x legendProperty (LSymbolFillColor s) = "symbolFillColor" .= fromColor s+legendProperty (LSymbolLimit x) = "symbolLimit" .= x legendProperty (LSymbolOffset x) = "symbolOffset" .= x legendProperty (LSymbolOpacity x) = "symbolOpacity" .= x legendProperty (LSymbolSize x) = "symbolSize" .= x@@ -482,6 +505,7 @@ legendProperty (LTitleFontStyle s) = "titleFontStyle" .= s legendProperty (LTitleFontWeight fw) = "titleFontWeight" .= fontWeightSpec fw legendProperty (LTitleLimit x) = "titleLimit" .= x+legendProperty (LTitleLineHeight x) = "titleLineHeight" .= x legendProperty (LTitleOpacity x) = "titleOpacity" .= x legendProperty (LTitleOrient orient) = "titleOrient" .= sideLabel orient legendProperty (LTitlePadding x) = "titlePadding" .= x
tests/ConfigTests.hs view
@@ -168,6 +168,7 @@ ] ) . configuration (ViewStyle [ ViewBackgroundStyle [ VBFill "#feb" ] ])+ . configuration (LegendStyle [ LeNoTitle ]) streamSpec = asSpec@@ -203,7 +204,9 @@ . configuration (BackgroundStyle "black") . configuration (TitleStyle [ TFont "Roboto", TColor "#fff" ]) . configuration (Axis [ DomainColor "yellow", GridColor "rgb(255,255,200)", GridOpacity 0.2, LabelColor "#fcf", TickColor "white", TitleColor "rgb(200,255,200)", LabelFont "Roboto", TitleFont "Roboto" ])- . configuration (LegendStyle [ LeFillColor "#333", LeStrokeColor "#444", LeTitleColor "rgb(200,200,200)", LeLabelColor "white", LeSymbolFillColor "red", LeGradientStrokeColor "yellow", LeLabelFont "Roboto", LeTitleFont "Roboto" ])+ . configuration (LegendStyle [ LeFillColor "#333", LeStrokeColor "#444", LeTitleColor "rgb(200,200,200)", LeLabelColor "white", LeSymbolFillColor "red", LeGradientStrokeColor "yellow", LeLabelFont "Roboto", LeTitleFont "Roboto"+ , LeDirection Horizontal+ ]) & compositeVis
tests/LegendTests.hs view
@@ -27,6 +27,7 @@ , ("limits1", limits 1) , ("limits2", limits 2) , ("limits3", limits 3)+ , ("disablelegend", disableLegend) ] @@ -191,10 +192,12 @@ , LLabelOpacity 0.6 , LLabelFontSize 20 , LLabelColor "fireBrick"+ , LLabelExpr "'<' + datum.label + '>'" , LLabelFontWeight W600 , LLabelBaseline AlignTop , LLabelAlign AlignRight , LLabelOverlap OGreedy+ , LSymbolLimit 5 ] @@ -225,3 +228,13 @@ , enc [] , mark Point [MFilled True] ]+++-- Vega-Lite 4.8+--+-- At the time of writing (V-L 4.8.1 has just neen released), the JS display libs+-- don't do anything with this setting. I assume this is a bug or they haven't been+-- updated yet.+--+disableLegend :: VegaLite+disableLegend = legendCoreCfg [ LeDisable True ]
tests/ShapeTests.hs view
@@ -258,6 +258,11 @@ config = configure . configuration (ViewStyle [ ViewNoStroke ])+ -- I expected this to mean I could remove PAxis [] fro+ -- the encoding, but it doesn't see to work in Vega-Lite 4.8.1+ -- (or I mis-understand this).+ --+ . configuration (Axis [Disable True]) dataVals = dataFromColumns []@@ -275,8 +280,9 @@ mpath = M.lookup "person" isotypes enc = encoding- . position X [ PName "col", PmType Ordinal, PAxis [] ]- . position Y [ PName "row", PmType Ordinal, PAxis [] ]+ -- see note in config about PAxis+ . position X [ PName "col", PmType Ordinal, PAxis []]+ . position Y [ PName "row", PmType Ordinal, PAxis []] . shape [ MPath (fromMaybe "circle" mpath) ] . color [ MSelectionCondition (SelectionName "highlight")
tests/ViewCompositionTests.hs view
@@ -18,6 +18,18 @@ , ("columns2", columns2) , ("columns3", columns3) , ("columns4", columns4)+ , ("lorientrighthdr", lorientRightHdr)+ , ("lorientrightcnf", lorientRightCnf)+ , ("torientrighthdr", torientRightHdr)+ , ("torientrightcnf", torientRightCnf)+ , ("orientrighthdr", orientRightHdr)+ , ("orientrightcnf", orientRightCnf)+ , ("lorientbottomhdr", lorientBottomHdr)+ , ("lorientbottomcnf", lorientBottomCnf)+ , ("torientbottomhdr", torientBottomHdr)+ , ("torientbottomcnf", torientBottomCnf)+ , ("orientbottomhdr", orientBottomHdr)+ , ("orientbottomcnf", orientBottomCnf) , ("groupyage", groupByAge) , ("grid1", grid1) , ("grid2", grid2)@@ -78,13 +90,43 @@ columns4 = genderChart [ HTitleFontSize 20- , HLabelFontSize 15+ , HTitleFontWeight Normal , HTitlePadding (-27)+ , HLabelBaseline AlignLineBottom+ , HLabelFontSize 15+ , HLabelFontWeight Bold+ , HLabelLineHeight 14 -- not used here, but set it anyway , HLabelPadding 40 ] [] +lorientRightHdr, lorientRightCnf :: VegaLite+lorientRightHdr = genderChart [ HLabelOrient SRight ] []+lorientRightCnf = genderChart [] [ HLabelOrient SRight ]++torientRightHdr, torientRightCnf :: VegaLite+torientRightHdr = genderChart [ HTitleOrient SRight ] []+torientRightCnf = genderChart [] [ HTitleOrient SRight ]++orientRightHdr, orientRightCnf :: VegaLite+orientRightHdr = genderChart [ HOrient SRight ] []+orientRightCnf = genderChart [] [ HOrient SRight ]++lorientBottomHdr, lorientBottomCnf :: VegaLite+lorientBottomHdr = genderChart [ HLabelOrient SBottom ] []+lorientBottomCnf = genderChart [] [ HLabelOrient SBottom ]++torientBottomHdr, torientBottomCnf :: VegaLite+torientBottomHdr = genderChart [ HTitleOrient SBottom ] []+torientBottomCnf = genderChart [] [ HTitleOrient SBottom ]++orientBottomHdr, orientBottomCnf :: VegaLite+orientBottomHdr = genderChart [ HOrient SBottom ] []+orientBottomCnf = genderChart [] [ HOrient SBottom ]+++ groupByAge :: VegaLite groupByAge = let conf = noStroke@@ -158,6 +200,7 @@ encByCatVal :: [EncodingSpec] -> PropertySpec encByCatVal = encoding+ -- see note about removing 'PAxis []' in gridConfig . position X [ PName "cat", PmType Ordinal, PAxis [] ] . position Y [ PName "val", PmType Quantitative, PAxis [] ] . color [ MName "cat", MmType Nominal, MLegend [] ]@@ -179,7 +222,10 @@ , ViewFillOpacity 0.2 , ViewContinuousHeight 120 ]) . configuration (FacetStyle fopts)-+ -- I had thought that disabling the axis would be the same as setting+ -- PAxis [] for both axes, but it doesn't behave that way with+ -- Vega Lite 4.8.1 (or I mis-understand this)+ . configuration (Axis [Disable True]) grid1 :: VegaLite grid1 =
tests/specs/config/dark.vl view
@@ -90,6 +90,7 @@ "legend": { "gradientStrokeColor": "yellow", "fillColor": "#333",+ "direction": "horizontal", "labelColor": "white", "titleFont": "Roboto", "symbolFillColor": "red",
tests/specs/config/vbTest.vl view
@@ -107,6 +107,9 @@ }, "view": { "fill": "#feb"+ },+ "legend": {+ "title": null } }, "data": {
tests/specs/legend/corners2.vl view
@@ -17,7 +17,9 @@ "fillColor": "pink", "labelOverlap": "greedy", "rowPadding": 15,+ "symbolLimit": 5, "labelColor": "fireBrick",+ "labelExpr": "'<' + datum.label + '>'", "titlePadding": 20, "symbolStrokeWidth": 1, "labelFontWeight": 600,@@ -38,7 +40,9 @@ "fillColor": "pink", "labelOverlap": "greedy", "rowPadding": 15,+ "symbolLimit": 5, "labelColor": "fireBrick",+ "labelExpr": "'<' + datum.label + '>'", "titlePadding": 20, "symbolStrokeWidth": 1, "labelFontWeight": 600,@@ -59,7 +63,9 @@ "fillColor": "pink", "labelOverlap": "greedy", "rowPadding": 15,+ "symbolLimit": 5, "labelColor": "fireBrick",+ "labelExpr": "'<' + datum.label + '>'", "titlePadding": 20, "symbolStrokeWidth": 1, "labelFontWeight": 600,
+ tests/specs/legend/disablelegend.vl view
@@ -0,0 +1,36 @@+{+ "height": 300,+ "config": {+ "legend": {+ "disable": true+ }+ },+ "mark": "circle",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/cars.json"+ },+ "width": 300,+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "Origin",+ "type": "nominal"+ },+ "size": {+ "field": "Horsepower",+ "type": "quantitative"+ },+ "opacity": {+ "field": "Weight_in_lbs",+ "type": "quantitative"+ },+ "x": {+ "field": "Horsepower",+ "type": "quantitative"+ },+ "y": {+ "field": "Miles_per_Gallon",+ "type": "quantitative"+ }+ }+}
tests/specs/shape/isotype1.vl view
@@ -13,6 +13,9 @@ "config": { "view": { "stroke": null+ },+ "axis": {+ "disable": true } }, "mark": {
tests/specs/viewcomposition/columns4.vl view
@@ -37,8 +37,12 @@ "column": { "field": "gender", "header": {+ "titleFontWeight": "normal", "titlePadding": -27,+ "labelLineHeight": 14, "labelPadding": 40,+ "labelFontWeight": "bold",+ "labelBaseline": "line-bottom", "labelFontSize": 15, "titleFontSize": 20 },
tests/specs/viewcomposition/grid1.vl view
@@ -13,6 +13,9 @@ "facet": { "columns": 5, "spacing": 80+ },+ "axis": {+ "disable": true } }, "data": {
tests/specs/viewcomposition/grid2.vl view
@@ -19,6 +19,9 @@ "facet": { "columns": 5, "spacing": 80+ },+ "axis": {+ "disable": true } }, "data": {
tests/specs/viewcomposition/grid3.vl view
@@ -18,6 +18,9 @@ }, "facet": { "spacing": 80+ },+ "axis": {+ "disable": true } }, "data": {
+ tests/specs/viewcomposition/lorientbottomcnf.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {+ "labelOrient": "bottom"+ }+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {},+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/lorientbottomhdr.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {}+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {+ "labelOrient": "bottom"+ },+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/lorientrightcnf.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {+ "labelOrient": "right"+ }+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {},+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/lorientrighthdr.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {}+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {+ "labelOrient": "right"+ },+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/orientbottomcnf.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {+ "orient": "bottom"+ }+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {},+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/orientbottomhdr.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {}+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {+ "orient": "bottom"+ },+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/orientrightcnf.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {+ "orient": "right"+ }+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {},+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/orientrighthdr.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {}+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {+ "orient": "right"+ },+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/torientbottomcnf.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {+ "titleOrient": "bottom"+ }+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {},+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/torientbottomhdr.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {}+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {+ "titleOrient": "bottom"+ },+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/torientrightcnf.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {+ "titleOrient": "right"+ }+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {},+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}
+ tests/specs/viewcomposition/torientrighthdr.vl view
@@ -0,0 +1,54 @@+{+ "transform": [+ {+ "filter": "datum.year == 2000"+ },+ {+ "as": "gender",+ "calculate": "datum.sex == 2 ? 'Female' : 'Male'"+ }+ ],+ "config": {+ "header": {}+ },+ "mark": "bar",+ "data": {+ "url": "https://vega.github.io/vega-lite/data/population.json"+ },+ "width": {+ "step": 17+ },+ "$schema": "https://vega.github.io/schema/vega-lite/v4.json",+ "encoding": {+ "color": {+ "field": "gender",+ "scale": {+ "range": [+ "#CC9933",+ "#3399CC"+ ]+ },+ "type": "nominal"+ },+ "x": {+ "field": "age",+ "type": "ordinal"+ },+ "column": {+ "field": "gender",+ "header": {+ "titleOrient": "right"+ },+ "type": "nominal",+ "spacing": 0+ },+ "y": {+ "field": "people",+ "aggregate": "sum",+ "type": "quantitative",+ "axis": {+ "title": "Population"+ }+ }+ }+}