GraphAlchemist / Alchemy

Other
517 stars 232 forks source link

chargeDistance is not a function #575

Open dschere opened 8 years ago

dschere commented 8 years ago

This code below:

Alchemy.prototype.generateLayout = function(instance) { var a; a = instance; return function(start) { var conf; if (start == null) { start = false; } conf = a.conf; a.layout = new Layout(a);

  return a.force = d3.layout.force().size([conf.graphWidth(), conf.graphHeight()]).theta(1.0).gravity(a.layout.gravity()).friction(a.layout.friction()).nodes(a.elements.nodes.d3).links(a.elements.edges.d3).linkDistance(function(link) {
    return a.layout.linkDistancefn(link);
  }).linkStrength(function(link) {
    return a.layout.linkStrength(link);
  }).charge(a.layout.charge()).chargeDistance(a.layout.chargeDistance());
};

};

Throws the following exception:

Uncaught TypeError: d3.layout.force(...).size(...).theta(...).gravity(...).friction(...).nodes(...).links(...).linkDistance(...).linkStrength(...).charge(...).chargeDistance is not a function

After tinkering around I narrowed it down to:

  }).charge(a.layout.charge()).   >>> chargeDistance <<<   (a.layout.chargeDistance());
dschere commented 8 years ago

Was able to work around by using a url for the dataSource and not an object.

jchock commented 8 years ago

Could you tell me how you included your CDNs? I've attempted several combinations already, using both downloaded and URL methods. I seem to be having the same issue as the person in #574 . Thanks!