2.0.0
Elm-vegalite V 2.0
Major release supporting Vega-Lite 4.0. Includes a small number of breaking changes that should provide greater flexibility and some simplification of the API.
Breaking Changes
title
now takes a list of optional title properties.
To update older code, simply add a[]
as a second parameter totitle
lookup
now allows naming of individual matched fields and a default for failed lookups.
Instead oflookup "key1" secondaryData "key2" ["field1", "field2"]
uselookup "key1" secondaryData "key2" (luFields ["field1", "field2"])
. Additional functionsluAs
,luAsWithDefault
,luFieldsAs
,luFieldsAsWithDefault
,luFields
andluFieldsWithDefault
provide greater flexibility in naming and default behaviour. It also uses theData
type alias as part of its type signature, which is unlikely to impact any use of the API but is technically a breaking change.
- Replaced
coRemoveInvalid
withmaRemoveInvalid
.
To stop filtering of invalid values, this is now specified as a mark property. For example, instead ofconfiguration (coRemoveInvalid False)
, useconfiguration (coMark [ maRemoveInvalid False ])
.
- Tooltips are now disabled by default (via change in Vega-lite).
Can be enabled either via an explicittooltip
channel, or by settingmaTooltip ttEncoding
.
- Background is now white by default (via a change in Vega-lite).
Previously backgrounds were transparent. Can mimic previous behaviour by adding a transparent configurationconfiguration (coBackground "rgba(0,0,0,0)")
axValues
now takesDataValues
(allowing numbers, strings, dates and Booleans) rather than just a list of floats.
To update older code, replaceaxValues [1,2,3] with axValues (nums [1,2,3])
.
- Removed (invalid) functions
mImpute
anddImpute
.
opArgMin
andopArgMax
now require aMaybe String
parameter.
To update older code, replaceopArgMin
withopArgMin Nothing
.
- Overlap strategy constructors hidden.
Should useosNone
,osGreedy
andosParity
instead. These were always available, but the constructors themselves had been inadvertently exposed, so it is unlikely to require a change in practice.
columns
now takes anint
rather thanMaybe int
.
To update older code, replacecolumns (Just n)
withcolumns n
andcolumns Nothing
withcolumns 0
.
Position
custom type has extra variantsXError
,XError2
,YError
andYError2
. Technically a breaking change but unlikely to affect existing specifications unless pattern matching againstPosition
.
Additions
Transforms
density
(and associateddn
density property functions) for KDE transforms.
loess
(and associatedls
loess property functions) for locally-estimated scatterplot smoothing.
pivot
(and associatedpi
pivot property functions) for data shaping.
quantile
(and associatedqt
quantile property functions) for computing quantiles from a distribution.
regression
(and associatedrg
regression property functions) for regression modelling.
fiOp
for converting filters intoBooleanOp
and therefore allowing Boolean composition of filter functions.
fiOpTrans
for combining an inline data transformation with a filter and converting to aBooleanOp
. Especially useful when filtering temporal data that require aggregating withmTimeUnit
.
Marks and Mark Properties
image
mark and associatedurl
channel andmaAspect
mark property for displaying images.
mSort
for sorting by mark properties likecolor
.
maColorGradient
,maFillGradient
andmaStrokeGradient
(and associatedgr
gradient property functions) for gradient-based colouring.
maCornerRadius
,maCornerRadiusBottomLeft
,maCornerRadiusBottomRight
,maCornerRadiusTopLeft
andmaCornerRadiusTopRight
for rounding a rectangle mark.
maWidth
andmaHeight
for explicitly setting mark width and height.
pBand
for setting position/size relative to a band width.
- Support empty strings for
maFill
andmaStroke
to indicate absence of fill or stroke.
Selections
lookupSelection
for lookups that rely on an interactive selection of data.
seBindLegend
and associated property functionsblField
,blChannel
andblEvent
for creating interactive legends.
seInitInterval
for initialising an interval selection's extent.
biSelectionExtent
for basing a bin extent on an interactive selection.
Configuration
- New title configuration options:
ticoFontStyle
,ticoFrame
,ticoStyle
,ticoZIndex
,ticoSubtitleColor
,ticoSubtitleFont
,ticoSubtitleFontSize
,ticoSubtitleFontStyle
,ticoSubtitleFontWeight
,ticoSubtitleLineHeight
andticoSubtitlePadding
.
coConcat
for configuring concatenations (cocoSpacing
andcocoColumns
).
vicoStep
for configuring default step size for discrete x and y discrete fields.
vicoContinuousWidth
,vicoDiscreteWidth
,vicoContinuousHeight
andvicoDiscreteHeight
for dimension configuration depending on type of data.
vicoBackground
for configuring default single view plot area background appearance.
Titles and Axes
title
and component titles (axis title, legend title etc.) can now be formatted over multiple lines with\n
or"""
multi-line strings.
axDataCondition
and associatedcAx
property functions for conditional axis formatting.
- Additional axis formatting options:
axGridColor
,axGridOpacity
,axGridWidth
,axLabelExpr
,axLabelFontStyle
,axLabelSeparation
,axTitleFontStyle
andaxTitleAnchor
along with extra config optionsaxcoLabelFontStyle
,axcoLabelSeparation
,axcoTitleFontStyle
andaxcoTitleAnchor
.
- New title option
tiSubtitle
for specifying secondary title text. Can be styled via new functionstiSubtitleColor
,tiSubtitleFont
,tiSubtitleFontSize
,tiSubtitleFontStyle
,tiSubtitleFontWeight
,tiSubtitleLineHeight
andtiSubtitlePadding
.
Data
noData
for preventing inheritance of parent data source in a specification.
nullValue
for explicitly setting data values to null.
dtMonthNum
for referencing a month by its numeric value.
tStr
for string literals in a text encoding channel.
Other
- Convenience functions for setting a channel's measurement type.
pNominal
,pOrdinal
,pQuant
,pTemporal
andpGeo
equivalent topMType Nominal
,pMType Ordinal
etc. Similar functions form
(mark),t
(text),h
(hyperlink),o
(order)d
(detail) andf
(facet) channels.
scAlign
for aligning marks within a range.
widthStep
andheightStep
for setting the width/height of a discrete x or y field (e.g. individual bars in a bar chart).
widthOfContainer
andheightOfContainer
for responsive sizing.
asFitX
andasFitY
for autosizing in one dimension only.
- Additional symbols
symTriangleLeft
,symTriangleRight
,symTriangle
,symArrow
,symWedge
andsymStroke
andmSymbol
convenience function for symbol literals.
equalEarth
map projection type.
key
channel for binding with Vega View API.
Deprecations
axcoShortTimeLabels
deprecated as this is the default since VL4.
axDates
deprecated in favour of new more flexibleaxValues
.
lookupAs
deprecated in favour oflookup
withluAs
.
scReverse
deprecated in favour ofmSort
(whilescReverse
works, it is not part of the Vega-Lite schema).
scRangeStep
, deprecated in favour ofwidthStep
andheightStep
.
sacoRangeStep
andsacoTextXRangeStep
deprecated in favour ofvicoStep
.
vicoWidth
andvicoHeight
deprecated in favour ofvicoContinuousWidth
,vicoDiscreteWidth
,vicoContinuousHeight
andvicoDiscreteHeight
.
coStack
deprecated as it is unecessary.
Bug Fixes
coFieldTitle
now correctly creates a 'functional' label.
- Overlap strategy
osNone
now evaluates correctly.
- Field definitions inside
mDataCondition
now handled correctly (previously only worked with value definitions).
- Empty grid/stroke dash list now correctly generates a
null
value rather than empty array in JSON spec (while an empty array works, it is not permitted by the Vega-Lite schema).
Other Changes
- Improvements to the API documentation with a larger number of inline examples.
- New gallery examples reflecting additions to the Vega-Lite example set.
- Numerous minor gallery example updates to reflect API changes and provide more idiomatic specifications.
- Additional tests for new functionality.