From 332e2c2a0a9d5717f4fcb6ec0bba797ffd3b443a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Alberto=20Polo=20Garc=C3=ADa?= Date: Tue, 29 May 2018 20:14:00 +0200 Subject: [PATCH] Added the functionality of resetting the data, new function 'resetWithNeo4jData' --- src/main/scripts/neo4jd3.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/scripts/neo4jd3.js b/src/main/scripts/neo4jd3.js index 0e53f349..6ca2c7b3 100644 --- a/src/main/scripts/neo4jd3.js +++ b/src/main/scripts/neo4jd3.js @@ -683,6 +683,12 @@ function Neo4jD3(_selector, _options) { var icons = Object.keys(options.iconMap); return icons[icons.length * Math.random() << 0]; } + + function resetWithNeo4jData(neo4jData) { + // Call the init method again with new data + var newOptions = Object.assign(_options, { neo4jData: neo4jData, neo4jDataUrl: undefined }); + init(_selector, newOptions); + } function rotate(cx, cy, x, y, angle) { var radians = (Math.PI / 180) * angle, @@ -962,6 +968,7 @@ function Neo4jD3(_selector, _options) { appendRandomDataToNode: appendRandomDataToNode, neo4jDataToD3Data: neo4jDataToD3Data, randomD3Data: randomD3Data, + resetWithNeo4jData: resetWithNeo4jData, size: size, updateWithD3Data: updateWithD3Data, updateWithNeo4jData: updateWithNeo4jData,