Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with d3.v4 #15

Open
nasagfunaro opened this issue Aug 29, 2016 · 6 comments
Open

Does not work with d3.v4 #15

nasagfunaro opened this issue Aug 29, 2016 · 6 comments

Comments

@nasagfunaro
Copy link

Error: Uncaught TypeError: d3.rebind is not a function when run against
<script src="https://d3js.org/d3.v4.min.js"></script>
in d3.parsets.js line 428

@Sigfried
Copy link

Sigfried commented Feb 2, 2018

Does anyone know if this or some other implementation of parsets has been ported to v4?

@Sigfried
Copy link

Sigfried commented Feb 4, 2018

This was easily fixed by adding rebind from v3 into the code:

 line 432:
//return d3.rebind(parsets, event, "on").value(1).width(960).height(600);
return rebind(parsets, event, "on").value(1).width(960).height(600);


function rebind(target, source) {
  var i = 1,
    n = arguments.length,
    method;
  while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
  return target;
};

function d3_rebind(target, source, method) {
  return function() {
    var value = method.apply(source, arguments);
    return value === source ? target : value;
  };
}
function d3_functor(v) {
  return typeof v === "function" ? v : function() { return v; };
}

@Sigfried
Copy link

Sigfried commented Feb 8, 2018

After fixing the rebind and functor stuff, the next problem I run into is with the code in the example:

var partition = d3.partition()
      .sort(null)
      .size([chart.width(), chart.height() * 5 / 4])
      .children(function(d) { return d.children ? d3.values(d.children) : null; })
      .value(function(d) { return d.count; });

× TypeError: d3.partition(...).sort is not a function

@hervenivon
Copy link

I'm really interested in that "beautiful implementation" too. Any progress @Sigfried?

@Sigfried
Copy link

I think I got it working after considerable futzing, but I'll need to look around for it when I get a chance.

john-guerra added a commit to john-guerra/d3-parsets that referenced this issue Jun 27, 2019
@john-guerra
Copy link

@Sigfried here is a version that should work with v4/v5 #19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants