question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dc.js 4.0: d3 6.0 and ES6

See original GitHub issue

There has been a lot of interest in the dc.js community for an ES6 version, but it was not a priority to me as long as we had to transpile and run on IE. (*)

However, d3 6.0 will finally drop IE - see d3/d3-array#87. Glory day! We can use ES6 natively!

I’d be happy to work with someone or a team of people who want to port dc.js to Rollup, NO BABEL or transpilation, and ES6 modules. I think we should keep the code in one repo but have lots of modules in it. ES6 modules should allow anyone to mix and match their own dc.js charts or versions of dc.js charts with those in the official repo, and only take what they need.

I don’t have the time to do all this work myself, but I have the time to do code review, make decisions and commit PRs for this project.

Challenges:

  1. The dependency between modules is complicated. I think we will save ongoing effort by staying in one repo with one version number, but we still need to figure out the dependencies beyond the class hierarchy. I’ll bet there are many places where the dependencies are not pure, yet we want tree-shaking to work, etc.
  2. Currently dc.js does not use prototype inheritance, so the path to ES6 classes is not completely clear. I doubt it will lead to significant performance improvements, but it would be nice to use idiomatic ES6 classes. There may be things we are doing, like adding and changing methods on other classes, which will not work or will cause subtle bugs.
  3. As much as possible, we should be able to keep code written for DCv3 working with v4, but where ES6 helps the dc.js API, we should use it. ES6 classes may break the interface a little. I don’t know if we’ll have trouble with the places where people replace methods like yAxisMin in order to get the right effect.

We can’t fix everything at once - let’s try to leave drastic interface changes for later, wherever possible.

I bet a lot of people out there have already gone through the ES5->ES6 transformation and know the best practices. Anyone have time to take this up? Anyone have experience with Rollup the way it is used to bundle D3?

Please leave a comment if you’re interested in working on this: doing the translation, review PRs, help debug, or just offer advice.

I know some people worked with @mtrayham’s fork #1175. I closed the PR because I didn’t want to transpile & still don’t want to. I also want to use rollup instead of webpack because it is simpler. Nonetheless it’s the right direction - did anyone try to merge that fork with the D3v4/5 changes in 3.x?

I don’t know how many d3 modules have dropped ES5 and moved to ES6. I know of d3-array and d3-force so far, but d3 6.0 has not been released yet. We have the opportunity to get ahead of the curve and release DCv4 soon after D3v6.

(*) I continue to be opposed to transpilation, since we frequently need to debug incompatibilities using the devtools of every browser. In my experience, only the Chrome debugger works reliably for debugging transpiled code. However, if someone else wants to maintain the toolchain for transpiling dc.js 4.0, and debug any issues that arise, I am cool with that!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:25 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
gordonwoodhullcommented, Dec 28, 2019

I decided not to hold things up any longer.

I am releasing v4 without the elasticX change. We will maintain v3 for a while, and we can continue to do fixes using the support/3.x branch

1reaction
gordonwoodhullcommented, Jan 9, 2020

Did not receive any reports, so dc.js 4.0 is released.

Amazing work @kum-deepak!

Read more comments on GitHub >

github_iconTop Results From Across the Web

dc.js - Dimensional Charting Javascript Library
js is a javascript charting library with native crossfilter support, allowing highly efficient exploration on large multi-dimensional datasets (inspired by ...
Read more >
What is the correct way to import and use d3 and its ...
This is all to run charts using dc , which builds on a lot of d3 features. My complete imports for the chart...
Read more >
D3.js - Product Information, Latest Updates, and Reviews 2022
Wedgetail is a small and simple profiler. It's focus is to provide timing information for a large number of invocations of the same...
Read more >
@ecloudtech/dc-table - npm
This library is developed as an ES6 module but output is generated in UMD, systemJS and Common JS formats as well. Include as...
Read more >
d3 - Libraries - cdnjs - The #1 free and open source CDN built ...
d3. A JavaScript visualization library for HTML and SVG. ... https://cdnjs.cloudflare.com/ajax/libs/d3/7.8.0/d3.min.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found