7 ms·
Since I used d3.js for one project a few years ago, I have not touched jQuery ever since. d3 offers key jQuery features, but goes much more beyond that.
by paradite 10y ago
Since I used d3.js for one project a few years ago, I have not touched jQuery ever since. d3 offers key jQuery features, but goes much more beyond that.
- tangue 10y agoI've often head this and it would probably be in my next-side project. Do you have an AJAX API bundled with D3 or are you using some custom functions ?
- djKianoosh 10y agoyou can use whatwg-fetch instead of jquery ajax
- GroSacASacs 10y agonative fetch is not available in IE<11
- djKianoosh 10y agowhatwg-fetch polyfill works well
- paradite 10y agod3.json, d3.csv, d3.xhr etc You can check the documentations here: https://github.com/d3/d3/wiki/Requests https://github.com/d3/d3/wiki/Requests Those methods are quite powerful.
- KurtMueller 10y agoWhat do you typically use it for?
- paradite 10y agoIt basically replaces jQuery, so there's that. And it's the default choice for any complex web data visualization project.
- SippinLean 10y agoIt lacks a ton of key features. No eq(), toggleClass(), show(), length, etc. Sure you can rewrite them in D3 but why bother?
- mhimmel 10y agoeq() is equivalent to selecting an item from an array and can be replaced by using bracket notation (e.g., arr[1]). In D3 you can do selection.classed('active', false). This is equivalent to toggleClass(). According to jQuery's API, show() "... is roughly equivalent to calling .css( "display", "block"), except that the display property is restored to whatever it was initially." Instead of show, you can just do selection.transition().duration(300).style(display, 'block'). The length method? You can just use JavaScript's native .length.