v5.13.0
Notable Changes
-
Improved Streaming Performance.
For performance, Vega caches a lot of internal data structures, including calculated tuples, scenegraph items, and SVG DOM nodes. Previously, nested scopes (such as those created for facetted data) that result in vega-runtime subcontexts were never cleaned. If no external View API calls are made, this is fine, and actually improves performance for interaction-driven dynamic filtering. However, when providing streaming data to Vega through the View API, uncleaned caches and subcontexts can result in substantial memory leaks that also eventually degrade performance.
This version adds mechanisms for clearing caches and detaching subflows to support streaming data within nested specifications. When input data is removed via a View API call or via signal-valued URL, Vega will now by default trigger garbage collection to reclaim resources. This behavior can be disabled by calling
clean(false)on a constructed ChangeSet passed to the View API. -
Improved Cursor Performance.
Previously Vega updated the
cursorstyle on the HTML document body. This persists cursor settings even during interactions (such as drags) that may leave the Vega View component. However, it also can result in large performance penalties in Chrome, which re-evaluates CSS styles in response. This version changes the default behavior to set the cursor locally on the Vega View component. If a global cursor is desired, the boolean config propertyevents.globalCursorcan be settrueor the View methodglobalCursorcan be invoked to change the setting at runtime. -
Optional Expression Interpreter.
This release adds interpreter support for Vega expressions that is Content Security Policy (CSP) compliant. By default, the Vega parser performs code generation for parsed Vega expressions, and the Vega runtime uses the Function constructor to create JavaScript functions from the generated code. Although the Vega parser includes its own security checks, the runtime generation of functions from source code nevertheless violates security policies designed to prevent cross-site scripting.
This release provides an interpreter plug-in (the new
vega-interpreterpackage) that evaluates expressions by traversing an Abstract Syntax Tree (AST) for an expression and performing each operation in turn. Use of the interpreter enables compliance with CSP, but can incur a performance penalty. In tests of initial parse and dataflow evaluation times, the interpreter is on average ~10% slower. Interactive updates may incur higher penalties, as they are often more expression-heavy and amortize the one-time cost of Function constructor parsing.
Changelog
Changes from v5.12.3:
vega
- Update
stream.htmlandstream-nested.htmlperformance test pages.
vega-dataflow
- Add
detachmethod toOperatorto remove adjacent edges (listeners) from the dataflow graph. - Add
cleansetter toChangeSet, set totrueby default if any tuples are removed. - Add
cleangetter/setter to Pulse, propagate value to forked pulses if they share a datasource. - Update logging calls during Dataflow evaluation.
vega-encode
- Update
DataJointransform to clean internal map whenpulse.clean()is true. - Update
Scaleto includedomainMidas an extrema if it exceeds the domain min or max. (#2656)
vega-functions
- Fix scale function to not special case
undefinedinput. This ensures identical semantics with the internal_scalehelper function used by code-generated encoders.
vega-geo
- Update d3-geo dependency.
vega-interpreter
- Add new vega-interpreter package.
vega-projection
- Update d3-geo dependency.
vega-projection-extended
- Update vega-projection dependency.
vega-runtime
- Add runtime
detachmethod to remove subcontexts. Export asdetachSubflowon the head operator of a generated subflow. - Add pluggable expression evaluators.
vega-statistics
- Fix
numbersutility to exclude empty string.
vega-transforms
- Update
Aggregatetransform to clean internal map whenpulse.clean()is true. - Update
Facet,PreFacet, andSubflowtransforms to prune subflows in response topulse.clean(). - Update
Loadtransform to setpulse.clean(true)when removing loaded data. - Fix
BinandExtentto treat empty string as a missing value. (thanks @domoritz!) - Fix aggregate ops to treat empty string as a missing value.
vega-typings
- Add
eventConfig.globalCursorto config typings. - Add dataflow logger to typings.
- Add parse options to typings.
vega-util
- Refactor code for
fastmapandvisitArrayutilities.
vega-view
- Add View constructor option
exprto pass in a custom expression evaluator. - Add
globalCursormethod and event configuration. - Update to make the Vega view container the default cursor target.