D3.JS 6 Adds Iterable Support |
Written by Kay Ewbank |
Tuesday, 01 September 2020 |
There's a new version of D3.js, the JavaScript library for manipulating documents based on data. Improvements in D3 v6 include a move to using native collections (Map and Set), as well as the ability to accept iterables. D3.js is a JavaScript library for manipulating documents based on data using HTML, SVG, and CSS. Its use of standard web techniques avoids the need for a proprietary framework. The library offers data visualization components and a data-driven approach to DOM manipulation. The data display elements can be used to create graphs, interactive graphics, data-based maps, and information dashboards. This release has adopted ES2015, including support for iterables and collections (Map and Set). ES2015 added the iterable protocol so that objects can be made iterable and capable of being used in a for...of loop. It also introduced new data structures including Map and Set. Maps are collections of keys and values of any type, while Sets are ordered lists of values that contain no duplicates. Instead of being indexed like arrays are, sets are accessed using keys. Alongside the iterables and collections support, new aggregate functions have been added to replace d3.nest. The new functions are d3.group and d3.rollup, and the developers say they work well with d3-hierarchy and d3-selection. New helpers have been added to d3-array, too, including d3.greatest, d3.quickselect, and d3.fsum. D3 now passes events directly to listeners, replacing the d3.event global and bringing D3 inline with vanilla JavaScript and most other frameworks. Another improvement is d3-delaunay, which is based on the library for Delaunay triangulation of 2D points. The new function replaces d3-voronoi, and offers dramatic improvements to performance, robustness, and search, according to the development team. Another development based on Delaunay is d3-geo-voronoi for spherical (geographical) data. Other function improvements include an expanded d3-random that includes a fast linear congruential generator for seeded randomness; d3-chord has new layouts for directed and transposed chord diagrams; and d3-scale adds a new radial scale type. Finally, more than 450 examples have been updated to D3 v6.
More InformationRelated ArticlesD3.js By Example (Book Review) To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
Last Updated ( Tuesday, 01 September 2020 ) |