Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setTimeout(() => {
const container = document.querySelector('#view-' + this.relationViews.views[viewName].topo_flatten.join(''))
const n = new Network(container, data, options)
console.log(n) // TODO
}, 100)
})
physics: {
enabled: false
},
interaction: {
hover: true,
dragView: true,
dragNodes: true,
multiselect: true
}
}
// initialize your network!
this.container.oncontextmenu = () => { return false }
this.options = options
this.viewData = data
this.network = new Network(this.container, data, options)
this.canvas = this.network.canvas.frame.canvas
this.ctx = this.canvas.getContext('2d')
})
},
smooth: false,
color: "#000000",
width: 0.5,
arrows: {
to: {
enabled: true,
scaleFactor: 0.5
}
}
}
};
// merge user provied options with our default ones
let options = defaultsDeep(defaultOptions, this.props.options);
this.Network = new vis.Network(
container,
Object.assign({}, this.props.graph, {
edges: this.edges,
nodes: this.nodes
}),
options
);
if (this.props.getNetwork) {
this.props.getNetwork(this.Network);
}
if (this.props.getNodes) {
this.props.getNodes(this.nodes);
}
const nodes = new vis.DataSet(this.githubUsers.map((user) => ({
id: user.id,
label: user.login,
title: user.login
})));
// create an array with edges
const edges = new vis.DataSet(this.githubUsers.slice(1).map((user, idx) => {
return {
from: this.githubUsers[idx].id,
to: user.id
};
}));
if (!this.network) {
this.network = new vis.Network(this.host, { nodes, edges }, {
interaction: {
hover: true
},
nodes: {
color: {
hover: {
border: '#2B7CE9',
background: '#D2E5FF'
}
}
}
});
} else {
this.network.setData({ edges, nodes });
}
}
physics: {
enabled: false
},
interaction: {
hover: true,
dragView: true,
dragNodes: true,
multiselect: true
}
}
// initialize your network!
this.container.oncontextmenu = () => { return false }
this.options = options
this.viewData = data
this.network = new Network(this.container, data, options)
this.canvas = this.network.canvas.frame.canvas
this.ctx = this.canvas.getContext('2d')
})
},
edges: {
arrows: {
to: {
type: "arrow",
enabled: true
}
}
},
nodes: {
shape: 'circle'
},
interaction: {
selectConnectedEdges: false
}
};
var network = new vis.Network(container, data, options);
network.on("selectNode", function(params) {
var nid = params.nodes[0];
Notification.closeAll();
var node = nodes._data.get(nid);
console.info(node)
var title = "id:" + node.id + ",\nlabel:" + node.label;
var c = "";
var props = node.properties;
for (var i = 0; i < props.length; i++) {
c += props[i].key + ":" + props[i].value + "<br>";
}
Notification({
title: title,
message: c,
dangerouslyUseHTMLString: true,
duration: 500000,
toggleSelect (checked) {
if (checked) {
this.canSelect = true
this.options.autoResize = false
this.options.interaction.hover = false
this.options.interaction.dragView = false
this.options.interaction.dragNodes = false
this.network = new Network(this.container, this.viewData, this.options)
this.canvas = this.network.canvas.frame.canvas
this.ctx = this.canvas.getContext('2d')
} else {
this.canSelect = false
this.options.autoResize = true
this.options.interaction.hover = true
this.options.interaction.dragView = true
this.options.interaction.dragNodes = true
this.network = new Network(this.container, this.viewData, this.options)
this.canvas = this.network.canvas.frame.canvas
this.ctx = this.canvas.getContext('2d')
}
},
componentDidMount() {
const data = {
nodes: this.props.nodeHolder,
edges: this.props.edgeHolder
};
const network = new vis.Network(this.refs.myRef, data, this.props.networkOptions);
network.on('selectNode', (params) => {
const nodeId = params.nodes && params.nodes.length > 0 ? params.nodes[0] : null;
this.props.dispatch({ type: ACTIONS.SET_SELECTED_NODE, payload: nodeId });
});
network.on("selectEdge", (params) => {
const edgeId = params.edges && params.edges.length === 1 ? params.edges[0] : null;
const isNodeSelected = params.nodes && params.nodes.length > 0;
if (!isNodeSelected && edgeId !== null) {
this.props.dispatch({ type: ACTIONS.SET_SELECTED_EDGE, payload: edgeId });
}
});
this.props.dispatch({ type: ACTIONS.SET_NETWORK, payload: network });
}
if (checked) {
this.canSelect = true
this.options.autoResize = false
this.options.interaction.hover = false
this.options.interaction.dragView = false
this.options.interaction.dragNodes = false
this.network = new Network(this.container, this.viewData, this.options)
this.canvas = this.network.canvas.frame.canvas
this.ctx = this.canvas.getContext('2d')
} else {
this.canSelect = false
this.options.autoResize = true
this.options.interaction.hover = true
this.options.interaction.dragView = true
this.options.interaction.dragNodes = true
this.network = new Network(this.container, this.viewData, this.options)
this.canvas = this.network.canvas.frame.canvas
this.ctx = this.canvas.getContext('2d')
}
},