v3.0.0
What's Changed
- Upgraded d3 v5 to v7 (BREAKING CHANGE) by @lloydrichards in #20
- Remove polyfills for EI (BREAKING CHANGE) by @lloydrichards in #26
- Update code examples to use modern ES6 features by @lloydrichards in #27
The sszvis
library now is dependent on d3
version 7 (see d3 v6 migration guide). This means you will need to upgrade any scripts that import v5 to v7.
<script src="https://unpkg.com/d3@7/dist/d3.min.js"></script>
The upgrade to d3 v7 comes with a few breaking changes. The most notable one is the usage of newer ES6 data structures like Map
and Set
instead of the old d3.map
and d3.value
based data structures. This change was necessary to improve performance and to align with modern JavaScript practices.
// This d3 v5 code snippet should be updated to ...
state.maxStacked = d3.max(d3.values(dateValues), function (s) {...});
// ... this d3 v7 code snippet
state.maxStacked = d3.max(Object.values(dateValues), (s) => {...});
The other major change is that to mouse event handlers which are now the first argument in the callback for any event listeners. This change causes any existing code that uses interactions (hover, mouse clicks etc) to break.
// This d3 v5 code snippet should be updated to ...
toggleMultiples: function (g) {
state.isMultiples = g === "Separiert";
render(state);
},
// ... this d3 v7 code snippet
toggleMultiples: (e, g) => {
state.isMultiples = g === "Separiert";
render(state);
},
The last change is to the voronoi functionality which has now been updated to use Delaunay. The only noticeable change now is how boundaries are set, now accepting a single array of numbers, rather then two points:
// This d3 v5 code snippet should be updated to ...
var mouseOverlay = sszvis
.voronoi()
...
.bounds([
[-bounds.padding.left, -bounds.padding.top],
[bounds.innerWidth + bounds.padding.right, bounds.innerHeight + 20],
]);
// ... this d3 v7 code snippet
var mouseOverlay = sszvis
.voronoi()
...
.bounds([
-bounds.padding.left,
-bounds.padding.top,
bounds.innerWidth + bounds.padding.right,
bounds.innerHeight + 20,
]);
Full Changelog: v2.6.8...v3.0.0