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.

Hi @kum-deepak!

As promised, I’m doing a thorough line-by line review of #1363 d3v4 support.

Rather than comment inline on a PR that has already been merged, I decided to start a new issue.

I think I have gotten through about 1/3 of the changes, and I’m learning a lot along the way!

Here are my comments so far. I’m going to go for a Saturday walk now. 😃

global changes

“selection”

The argument name selection is confusing for fadeDeselectedArea/brushIsEmpty/extendBrush / scatterPlot.brushIsEmpty scatterPlot._brushing because it sounds like it should be a d3 selection. Personally I would use the term filter or extent here.

I guess this arose because of event.selection from Brush Events so maybe brushSelection would be a good compromise. Kind of confusing that they reused such a common term.

composite chart

rightYAxis documentation: “depending on whether you are going to use the axis on left or right” doesn’t make sense, as it should always be d3.axisRight. I guess this was copied from coordinateGridMixin.yAxis but it’s different.

coordinate grid mixin

xUnitCount

This function now distinguishes dc.units.ordinal but it doesn’t need to because calling the function would have exactly the same effect. I’d rather not add the special case unless it’s necessary for some reason? The design of xUnits functions is perhaps a bit strange but it is generic.

If this really needs to be then it should at least use chart.isOrdinal().

prepareXAxis

I agree that we need to use d3.scaleBand instead of d3.scaleOrdinal – it’s so much cleaner! – but it will confuse users if their input .x() scale is changed. We should issue a warning every time we make the replacement so users can update their code accordingly.

prepareYAxis

       // Ideally we should update the API so that if someone uses Right Y Axis
       // they would need to pass _yAxis as well
       if (!_yAxis) {
           if (_useRightYAxis) {
                _yAxis = d3.axisRight();
            } else {
                _yAxis = d3.axisLeft();
            }
         }

I respectfully disagree with the comment - it’s really nice how the axes are automatically initialized and I think we should be able to extend that to the right axis.

This code will never get hit because _yAxis is initialized and the user would never set it to undefined or null.

Could we start with _yAxis null and initialize it like we’re doing here, when

  • this function is hit, or
  • when .yAxis() is called as a getter?

I think this would safely initialize it to axisLeft or axisRight automatically, and it would be nice not to default it wrong. The only way it might go wrong is if the user called .yAxis() before calling .useRightAxis(true) but I doubt anyone would do that.

Also, I know it was already there in the original, but I find

        _yAxis = _yAxis.scale(_y);

really confusing. .scale() is an ordinary setter which modifies the axis.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Filcommented, Apr 20, 2018

I’ve tried to use it in @observablehq with d3v5, and it sort of works, but some styling is off. Also I could’t require("dc"), I had to load it through bundle.run.

But other than that, it looks good. https://beta.observablehq.com/@fil/hello-dc-js

Congratulations! And what an achievement!

1reaction
gordonwoodhullcommented, Apr 20, 2018

Thanks @Fil!

Yes, we’ll have to iterate on it. I’m new to ES6 modules so I’m not surprised that we need to configure the module better. It’s still just straight old UMD.

As for styling, I see two problems. One, the cell heights are too short, at least on my iPad. That is perhaps a CSS problem.

Two, you need to set xUnits in order to get the bar widths right. I wish dc.js could figure that out automatically, but it can’t currently.

Yes, it was a huge amount of work, mostly by @kum-deepak. I’m really impressed that he figured this all out, and happy dc.js will live on for another few years!

Read more comments on GitHub >

github_iconTop Results From Across the Web

d3v4 force chart upgrade clean up - Stack Overflow
I am keen to clean up and reduce the codebase -- reduce the reliance on all the functions. I had to refactor the...
Read more >
[Solved]-How does DOM Node cleanup work in d3?-d3.js
(Aside: it's not clear whether the leak you are referring to is elements remaining in the DOM or orphaned elements not being reclaimed...
Read more >
dc | Yarn - Package Manager
Dimensional charting built to work natively with crossfilter rendered using d3.js. In dc.js, each chart displays an aggregation of some attributes through the ......
Read more >
scala-js/scala-js - Gitter
hi, i'm trying to load scala-js-d3v4 lib using ammonite script of @lihaoyi without success, interp.repositories() ++= Seq(coursierapi.
Read more >
南韩k乙组联赛赛程ghokl-【✔️官网so174·com✔️】
... 官网so174·com✔️】-韩国k2联赛赛程-南韩k乙组联赛赛程ghokl-【✔️官网so174·com✔️】-韩国k2联赛赛程p3wk-南韩k乙组联赛赛程d3v4-南韩k乙组联赛赛程bsbk.
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