D3.js 5.0 is out
github.com
github.com
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.
Really?
let response = await fetch('http://www.example.com');
let json = await response.json();
It's not not terse.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...
It's been great to rely on a standard function, than any of the libraries to make http requests.
Tho it has been a while since I checked TC39 status on fetch
Thoughts?
WHATWG handles Fetch and their spec[1] was updated seven days ago.
[0] https://github.com/tc39/proposals/blob/master/README.md [1] https://fetch.spec.whatwg.org
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
[2]: https://beta.observablehq.com/@fil/polyhedral-projections-wi...
[1]: https://commons.wikimedia.org/wiki/File:Map-of-human-migrati...
[2]: https://nordpil.com/static/images/redknot_migration.png
[3]: http://ngm.nationalgeographic.com/ngm/0603/feature2/map.html
[4]: https://imgur.com/5TFPcDa
[5]: 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
[6]: http://www.jakelow.com/essays/mapping-the-world-population
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.
I loved using D3 directly and found it amazing.
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.
[1] https://github.com/d3/d3-selection/blob/master/README.md#cre...
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.Thinking that promises are callbacks because .then() takes a function suggests misunderstanding.
There are backwards incompatible changes, so it has to be a major bump.
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.
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-function...
I don't recall responding to a comment that mentioned using deprecation warnings instead. :/
To understand the problems the community is trying to avoid, one only needs to go back to 2015-2016, when Angular 2 was released. At the time, AngularJS (aka Angular 1) was extremely hot; it had in record time become THE framework for any front-end developer to learn, and it looked set to dominate the landscape for years. And then, Angular 2 came out and it had a TON of changes. The learning curve of some elements of Angular 2 was very high for the average developer (TypeScript, reactive programming). And worst of all, the "migration path" from AngularJS to Angular 2 essentially amounted to a rewrite of your front-end application. Most never bothered updating their app, and most devs moved away from Angular, especially when React was released. All of that AngularJS experience that we accumulated became "outdated" in the span of about a year.
React was first released in 2013, whereas Angular (2) was first released in 2016. React was already a very popular and rapidly growing framework by that point, so the idea that people adopted it simply because of Angular 2 is clearly false.
And while the migration process from Angular 1 to 2 was painful, it's simply untrue to say that nobody bothered, or that every AngularJS developer moved away. If you look at a source like https://hotframeworks.com/, which sources framework popularity data from GitHub and Stack Overflow, you can see that Angular has achieved a significant amount of adoption, and there are plenty of examples of people migrating successfully from 1 to 2+.
Thank the lord!
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
Also the documentation is great, so check out the intro here:
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.
[1] https://github.com/d3/d3/wiki/Tutorials [2] http://alignedleft.com/work/d3-book-2e