Skip to content

chargeDistance is not a function #575

@dschere

Description

@dschere

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());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions