3 ms·
Speaking about mobile first. Are there plans to slim down D3 itself? d3-scale is just 18KB, great, but d3.min.js is 149KB and d3-scale relies on some more d3 a
by frik 11y ago
Speaking about mobile first. Are there plans to slim down D3 itself?
d3-scale is just 18KB, great, but d3.min.js is 149KB and d3-scale relies on some more d3 addon JS files like d3-array, d3-color, etc. - so to sum up: 187KB minified JS for d3-scale including all dependecies, correct?
Tests have shown, the optimal goal is to keep a web app smaller than 300KB minified JS size.
- rjayatilleka 11y agoI'm not a d3 dev, but from what I've heard is that the current d3.min.js is v3, the current standard. The various small modules that are coming out are v4, and are meant to entirely replace the larger d3 package. Ideally, the entirety of v4 should be smaller than the entirety of v3.
- frik 11y agoThanks, sound good. I would like to pick only specific parts to render some charts to slim down the JS size. If it's possible with v4 or already with d3-scale today (as another comment suggested), that's great.
- mbostock 11y agoIncluding dependencies and localization, d3-scale is 69KB minified and 24KB gzipped. You can make it smaller by excluding optional dependencies if they are not needed, such as d3-time and d3-time-format; you can make it even smaller by creating a custom bundle using Rollup. Here’s an example: http://bl.ocks.org/mbostock/9bd540de6728a1fb9343 http://bl.ocks.org/mbostock/9bd540de6728a1fb9343 So, yes. Making it easier for people to include only the code they are using is one of the motivations for breaking D3 up into separate modules (and adopting ES6 modules).
- frik 11y agoGreat, thanks a lot! Keep up your great work!