Die Eigenschaft 'weight' von undefined in der d3.force-Implementierung kann nicht gelesen werden
Ich bin jetzt schon eine Weile mit diesem Problem beschäftigt und habe keine Ahnung, was ich tun soll, selbst wenn ich die vorhandenen Antworten zugrunde lege. Ich erhalte diesen Fehler beim letzten JSON-Eintrag einer einheitlichen Antwort.
...{"paperCount": 1, "PMIDs": [20626970], "authorA": 79, "authorB": 80},
{"paperCount": 1, "PMIDs": [20492581], "authorA": 81, "authorB": 82},
{"paperCount": 1, "PMIDs": [20492581], "authorA": 81, "authorB": 83},
{"paperCount": 1, "PMIDs": [20492581], "authorA": 81, "authorB": 84},
{"paperCount": 1, "PMIDs": [20492581], "authorA": 82, "authorB": 83},
{"paperCount": 1, "PMIDs": [20492581], "authorA": 82, "authorB": 84},
{"paperCount": 1, "PMIDs": [20492581], "authorA": 83, "authorB": 84}]...
Der Code ist unten, um diese Informationen zu extrahieren. Es bleibt in der for-Schleife fehlerhaft ...
$.getJSON('/papers.txt', function(response){
var w = 1280,
h = 900,
fill = d3.scale.category10(),
nodes = d3.range(1000).map(Object),
links = d3.range(1000).map(Object);
var index = 0;
var mouseX = 0,
mouseY = 0;
for (var j = 0; j < response.length; j++){
links[j] = {source: nodes[response[j].authorA], target: nodes[response[j].authorB], value: response[j].paperCount};
}
Jede Hilfe wäre dankbar.
Vielen Dank!