9 ms·
D3.js 5.0 is out
- jackweirdy 9y agoStreaming responses is very cool
- tunesmith 9y agoIs the best way to accomplish sugiyama still to use dagre-d3?
- chrisweekly 9y agosugiyama?
- expiredtofu 9y agoSee [1], looks like a method for drawing digraphs. [1]https://github.com/d3/d3/issues/349 https://github.com/d3/d3/issues/349
- domoritz 9y agoAs far as I know, yes. Or use the wasm version of graphviz.
- fourthark 9y agodot is still the best. If you're okay with wasm, use Viz.js http://viz-js.com/ http://viz-js.com/
- yiransheng 9y agoFinally, `d3.create`[1] - it has been a minor pain pointer in d3 to create a detached selection for quite some time :) [1] https://github.com/d3/d3-selection/blob/master/README.md#create https://github.com/d3/d3-selection/blob/master/README.md#cre...
- kamac 9y agoThat seems like a small update compared to v4. Wouldn't it be better to brand it as a minor version and provide backwards compatibility with deprecation warning where Promises were added?
- arghwhat 9y agoIf following semver style: Major updates include backwards incompatible changes. Minor updates include new functionality but no backwards incompatible changes. Patch updates include no new functionality. There are backwards incompatible changes, so it has to be a major bump.
- thinkloop 9y agoOP was suggesting not to have included backwards-incompatible changes, using deprecation warnings instead and branding it as a minor upgrade
- coldtea 9y agoHence OP was suggesting not following the semantic versioning model. Why would they do that? To have extra work and to have to carry deprecated garbage and compatibility ports for a few releases more, instead of making a clean new version? Those that need compatibility can stick with 4 until they're ready.
- icebraining 9y agoThe semantic versioning model just says how you should update your version if you break compatibility, not that you can't avoid breaking compatibility. In fact, they suggest the opposite: "Before you completely remove the functionality in a new major release there should be at least one minor release that contains the deprecation so that users can smoothly transition to the new API." https://semver.org/#how-should-i-handle-deprecating-functionality https://semver.org/#how-should-i-handle-deprecating-function...
- arghwhat 9y ago
- cuchoi 9y agoAny good introductory tutorials for D3.js?
- et-al 9y agoMike Bostock (creator of D3) has a bunch of great code examples on bl.ocks.org. I would start with his General Update Pattern (the link below goes through 1-3), which is key to understanding D3 as binding data to SVG elements (hence the name Data-Driven Documents) and animating any transitions. General Update Pattern: https://bl.ocks.org/mbostock/3808218 https://bl.ocks.org/mbostock/3808218 Also the documentation is great, so check out the intro here: https://d3js.org/#introduction https://d3js.org/#introduction btw, if you're using D3 purely for charting, expect a lot of work to get something that looks decent. There charting libraries that have taken care of the styling and add functions on top of D3 to make your life easier.
- cuchoi 9y agoThanks! Very useful.
- newbear 9y agoAre there d3 only jobs? Aside from NYTimes, who is using d3? Thanks
- asanwal 9y agoWe do at CB Insights (and we are hiring)
- davidjankoski 9y agoopen for applications from europe as well?
- akuji1993 9y agoWe are using d3 a lot at our startup to build dashboards displaying huge amounts of data for our clients. We're just a small german startup though. But d3 has high adoption through the field of data vis.
- mcochrane 9y agoPromises instead of archaic callbacks. That's a feature I'm excited about!
- jordache 9y agopromise is callback. When used in the context of the simple data loading scenario typical of D3, there is no difference.
- bfred_it 9y agoNot exactly and not necessarily. You can await a Promise and not have any functions at all: await thing() console.log(‘Thing done’) Also you could attach multiple callbacks to the same Promise at any point, even long after the promise fulfilled.
- always_good 9y agoPromises compose, bubble errors, lift sync errors, can be awaited, have combinators like Promise.all(), they're where the ecosystem headed, and more. Thinking that promises are callbacks because .then() takes a function suggests misunderstanding.
- esturk 9y agoThey aren't even executed in the same queue.
- johnhenry 9y ago> D3 now uses Promises Thank the lord!
- thijsvandien 9y agoI'd suggest thanking the developers instead. :)
- johnhenry 9y agoYou are right. Much thanks to mbostock, curran, micahstubbs, jefkoslowski, gordonwoodhull, and baerrach.
- runarberg 9y agoIts funny, when I landed my first job as a software developer, in a statistical startup, I learned about promises using d3.queue[1]. This was before javascript had native promises, and around the javascript community was settling on A+ promises. But d3 was how I learned to write asynchronous code without relying solely on callbacks. [1]: https://github.com/d3/d3-queue https://github.com/d3/d3-queue
- Cthulhu_ 9y agoLikewise, but in jQuery, which in one version introduced a feature where you could add listeners to an ajax request and it'd get called after the response returned - I was like what? how? whoa!?
- jordache 9y agosarcasm? who cares about D3's data loading APIs... i mean most sophisticated JS apps using D3 wouldn't use D3 for data fetching from the service.
- always_good 9y agohttps://github.com/d3/d3-queue https://github.com/d3/d3-queue has 1360 stars and gets 50% as many daily downloads as d3 itself, so I wouldn't be too sure that nobody out there is using d3's async facilities.
- omarforgotpwd 9y agoWow, didn't even know about the Fetch API. XMLHTTPRequest, the API that changed software forever by igniting a wave of more powerful browser applications, is finally going to be replaced. Funny that the last 20 years of the web were all built on this ridiculous API that Microsoft came up with to try and make Outlook work in a browser. Good riddance, but you will be missed. Not that any of us has used that disgusting API directly in the last 10 years.
- coldtea 9y ago>Not that any of us has used that disgusting API directly in the last 10 years. Well, duh. It was a lower level API, offering more control. Fetch isn't much better. Half-arsed at best, and also needs a higher level wrapper to achieve the same terseness as popular AJAX utility libs.
- untog 9y ago> Fetch isn't much better. Half-arsed at best, and also needs a higher level wrapper to achieve the same terseness as popular AJAX utility libs. Really? let response = await fetch('http://www.example.com'); let json = await response.json(); It's not not terse.
- coldtea 9y agoThat's just for a GET. Sending e.g. a JSON POST request requires you to specify the content type and to manually stingify the payload. It's better than XMLHttpRequest but not as terse as the tons of helper libraries that we used (instead of XMLHttpRequest) anyway...
- nemothekid 9y agoIt's been around for 2 years, I noticed it when github released a polyfill. It's been great to rely on a standard function, than any of the libraries to make http requests.
- 9y ago
- jlukic 9y agoIncredible work, by an incredible programmer.
- jake-low 9y agoShout out to Philippe Rivière for the awesome work on d3-geo-polygon[1] (mentioned in the release notes), which enables tons of new map projections like these[2]. Philippe, if you're reading this, thank you. I'm really excited about d3-geo-polygon and I know a lot of others in the community are too. [1]: https://github.com/d3/d3-geo-polygon https://github.com/d3/d3-geo-polygon [2]: https://beta.observablehq.com/@fil/polyhedral-projections-with-d3-geo-polygon https://beta.observablehq.com/@fil/polyhedral-projections-wi...
- aeriklawson 9y agoWhat are the use cases for this functionality? Genuinely curious.
- jake-low 9y agoUnusual map projections like these are often curiosities, but the can also be useful for certain topics, like mapping migrations[1][2][3] or showing airline routes[4][5]. [1]: https://commons.wikimedia.org/wiki/File:Map-of-human-migrations.jpg https://commons.wikimedia.org/wiki/File:Map-of-human-migrati... [2]: https://nordpil.com/static/images/redknot_migration.png https://nordpil.com/static/images/redknot_migration.png [3]: http://ngm.nationalgeographic.com/ngm/0603/feature2/map.html http://ngm.nationalgeographic.com/ngm/0603/feature2/map.html [4]: https://imgur.com/5TFPcDa https://imgur.com/5TFPcDa [5]: https://imgur.com/6X91323 https://imgur.com/6X91323 Additionally, this project is a generalization of a feature that already existed in D3 (clipping spherical polygons to map boundaries -- previously you could only do this if the boundary in question was the antimeridian or a small circle centered at the origin). That generalization will make it easier to use some more common map projections that were already supported in d3-geo-projection[5] like as Goode's interrupted homolosine and Mollweide projections. These are useful projections for showing things like population density[6] where you care about preventing distortion in the landmasses but don't care about the oceans. While these projections were possible before, they required the use of SVG clip-paths and other tricks to prevent drawing outside the map bounds. In theory they could now be simplified using the polygon clipping implemented in d3-geo-polygon. [5]: https://github.com/d3/d3-geo-projection https://github.com/d3/d3-geo-projection [6]: http://www.jakelow.com/essays/mapping-the-world-population http://www.jakelow.com/essays/mapping-the-world-population
- ktpsns 9y agoI love d3js, but I had the feeling it never got so widespread as jQuery. Similarly, from my feeling, it never had such a revolutionary impact. Maybe I am wrong because the data-driven approach (ie. data binding) inspired a whole generation of frameworks. But is there a showcase of famours sites using d3js for anything beyond visualizations (say in a similar manner how jQuery is used across all web page client logic)?
- Vinnl 9y agoThe entire purpose of D3 is to be used for visualisations, so no, it's not really used for anything like that and doesn't have as wide a scope as jQuery.
- drej 9y agoThe sad state of affairs is that while D3 is brilliant in terms of API design, it is fairly low level, so few people use it directly. I've been using tools based on D3.js (like C3, NVD3) and it's been a joy. However, last time I checked (~mid 2017), most of these hadn't migrated to D3 v4, so I'm not sure how fast v5 adoption will be. Maybe some will skip v4 altogether and go directly to v5? At this point, I'm not sure which wrapper to use, because I don't want to get stuck with v3.
- nickonline 9y agoYou could change that. I loved using D3 directly and found it amazing.
- ehayes 9y agoI've been using Billboard.js as a drop-in replacement for C3. It's a fork made specifically to work on D3 v4+. https://naver.github.io/billboard.js/ https://naver.github.io/billboard.js/
- drej 9y agoAmazing, thanks. C3.js has been a real pleasure to use, so I'm glad this fork exists. Cheers.
- vanderZwan 9y agoFor the people who don't use it directly, give vega and/or vega-lite a try: https://vega.github.io/vega/ https://vega.github.io/vega/ https://vega.github.io/vega-lite/ https://vega.github.io/vega-lite/
- athenot 9y agoLow level, yes. But I happen to like it as an alternative to jquery.
- noir_lord 9y agoI needed a custom stacked timeline for the work system. I was planning to do something horrible and then remembered d3 from a post years ago, day of futzing around with examples and it does it cleanly in less than 300 lines of code. Genuinely impressive API as well.
- stareatgoats 9y agoLooks cool - would love to implement some things using D3! Would be interesting to know how people plan to handle browser incompatibility, or is it even a concern when approaching ~90% of browser usage support? [0] (for fetch, promises but mainly async/await in this case, if I understand it correctly) [0] https://caniuse.com/#feat=async-functions https://caniuse.com/#feat=async-functions
- codenberg 9y agoYou'll have to manually include polyfills for both Promise and Fetch to support things like IE 11 or iOS 10.2.
- pwthornton 9y agoI'm looking to get my team into using D3 more as we begin to do more graphing and data visualization. Do any of you have recommendations on tutorials, classes and other learning aids?