[BUGFIX] forcegraph show only online nodes
This commit is contained in:
parent
914f6a344b
commit
35fd75e4f6
@ -1,5 +1,5 @@
|
||||
define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease', 'd3-interpolate', 'utils/math', 'forcegraph/draw'],
|
||||
function (d3Selection, d3Force, d3Zoom, d3Drag, d3Timer, d3Ease, d3Interpolate, math, draw) {
|
||||
define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease', 'd3-interpolate', 'helper', 'utils/math', 'forcegraph/draw'],
|
||||
function (d3Selection, d3Force, d3Zoom, d3Drag, d3Timer, d3Ease, d3Interpolate, helper, math, draw) {
|
||||
'use strict';
|
||||
|
||||
return function (config, linkScale, sidebar, router) {
|
||||
@ -197,11 +197,9 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
|
||||
});
|
||||
|
||||
self.setData = function setData(data) {
|
||||
intNodes = data.nodes.all.map(function (d) {
|
||||
var e;
|
||||
if (d.node_id in dictNodes) {
|
||||
e = dictNodes[d.node_id];
|
||||
} else {
|
||||
intNodes = data.nodes.all.filter(helper.online).map(function (d) {
|
||||
var e = dictNodes[d.node_id];
|
||||
if (!e) {
|
||||
e = {};
|
||||
dictNodes[d.node_id] = e;
|
||||
}
|
||||
@ -211,15 +209,16 @@ define(['d3-selection', 'd3-force', 'd3-zoom', 'd3-drag', 'd3-timer', 'd3-ease',
|
||||
return e;
|
||||
});
|
||||
|
||||
intLinks = data.links.map(function (d) {
|
||||
var e = {};
|
||||
e.o = d;
|
||||
e.source = dictNodes[d.source.node_id];
|
||||
e.target = dictNodes[d.target.node_id];
|
||||
e.color = linkScale(d.source_tq);
|
||||
e.color_to = linkScale(d.target_tq);
|
||||
|
||||
return e;
|
||||
intLinks = data.links.filter(function (d) {
|
||||
return dictNodes[d.source.node_id] && dictNodes[d.target.node_id];
|
||||
}).map(function (d) {
|
||||
return {
|
||||
o: d,
|
||||
source: dictNodes[d.source.node_id],
|
||||
target: dictNodes[d.target.node_id],
|
||||
color: linkScale(d.source_tq),
|
||||
color_to: linkScale(d.target_tq)
|
||||
};
|
||||
});
|
||||
|
||||
force.nodes(intNodes);
|
||||
|
Loading…
Reference in New Issue
Block a user