GithubHelp home page GithubHelp logo

willcode2surf / d3-selection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from d3/d3-selection

0.0 2.0 0.0 121 KB

Transform the DOM by selecting elements and joining to data.

License: Other

Makefile 36.75% JavaScript 63.25%

d3-selection's Introduction

d3-selection

This EXPERIMENTAL module implements the core concept of D3: manipulating the DOM by selecting elements and joining to data.

API changes from D3 3.x:

  • The implementation is now organized into CommonJS modules, rather than the ad hoc SMASH concatenation process used previously. A standalone build is provided for your convenience using Browserify, but you are free to define your own build process (e.g., Webpack). See #2220.

  • The Selection class now extends Object, not Array, obviating the need for prototype injection (and direct property injection on runtimes that do not support __proto__). See #2191.

  • Selections are now truly hierarchical! Rather than always being a nested array, selections have arbitrary depth. Accessor functions such as those accepted by selection.attr and selection.style can now refer to parent data (and indices) if desired.

  • The selection.data method, when called with arguments, now modifies the current selection to be the update selection, rather than returning a new selection. Likewise, the enter and exit selections are lazily constructed and modified in-place. The selection.enter and selection.exit methods now return empty selections if the selection has not yet been bound to data. (Previously, attempting to access these methods before binding to data would throw an error.) See #2402.

  • The selection.data method, when called without arguments, now returns an array of data for all elements in the selection, not just the first group.

  • Similarly, a new selection selection.nodes method returns an array of all elements in the selection (flattening the underlying hierarchy).

  • The selection.insert method has been renamed (and replaces) selection.append. Thus, the enter.append method now inserts elements in data order by default when joining by key! (This assumes that new data is in the same order as old data; if not, use selection.order after.)

  • The enter.append method now moves (rather than copies) elements to the update selection. (In practice, you are unlikely to notice the difference, as enter selections are typically discarded upon append. But this makes more sense now that enter selections are persistent.)

  • Enter selections no longer have a special subclass. Instead, enter nodes function as virtual placeholders, providing appendChild and insertBefore methods for use with selection.append.

  • The selection.classed method has been renamed selection.class. (Note: class is a reserved word in ES6, but ES5 and later allow reserved words as identifier names.) The old name is deprecated but preserved for backwards-compatibility.

  • The selection.on method has been renamed selection.event. The old name is deprecated but preserved for backwards-compatibility.

  • A new selection.dispatch method dispatches a custom event of the specified type to all selected elements. It’s like trigger in jQuery.

  • The d3.ns.prefix namespace map is now exposed as d3.namespace. The old name is deprecated but preserved for backwards-compatibility.

  • Multi-value map variants of selection.attr, selection.style, selection.property, selection.class and selection.on are now implemented as distinct methods in the d3-selection-multi plugin, rather than overloading the arguments. See #2109.

  • Removed support for Sizzle. It’s time.

d3-selection's People

Contributors

mbostock avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.