Skip to content

Commit

Permalink
Merge pull request #208 from BurkusCat/improve-graph-performance
Browse files Browse the repository at this point in the history
Fix compositing performance (3x improvement)
  • Loading branch information
Trufflegator authored Apr 27, 2022
2 parents 7495e93 + f37899a commit 84f5bff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 52 deletions.
52 changes: 0 additions & 52 deletions src/main/scripts/neo4jd3.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,57 +646,6 @@ function Neo4jD3(_selector, _options) {
return graph;
}

function randomD3Data(d, maxNodesToGenerate) {
var data = {
nodes: [],
relationships: []
},
i,
label,
node,
numNodes = (maxNodesToGenerate * Math.random() << 0) + 1,
relationship,
s = size();

for (i = 0; i < numNodes; i++) {
label = randomLabel();

node = {
id: s.nodes + 1 + i,
labels: [label],
properties: {
random: label
},
x: d.x,
y: d.y
};

data.nodes[data.nodes.length] = node;

relationship = {
id: s.relationships + 1 + i,
type: label.toUpperCase(),
startNode: d.id,
endNode: s.nodes + 1 + i,
properties: {
from: Date.now()
},
source: d.id,
target: s.nodes + 1 + i,
linknum: s.relationships + 1 + i
};

data.relationships[data.relationships.length] = relationship;
}

return data;
}

function randomLabel() {
var icons = Object.keys(options.iconMap);
return icons[icons.length * Math.random() << 0];
}

function rotate(cx, cy, x, y, angle) {
var radians = (Math.PI / 180) * angle,
cos = Math.cos(radians),
Expand Down Expand Up @@ -1033,7 +982,6 @@ function Neo4jD3(_selector, _options) {

return {
neo4jDataToD3Data: neo4jDataToD3Data,
randomD3Data: randomD3Data,
size: size,
updateWithD3Data: updateWithD3Data,
updateWithNeo4jData: updateWithNeo4jData,
Expand Down
4 changes: 4 additions & 0 deletions src/main/styles/neo4jd3.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,14 @@ body {
}

.node {
will-change: transform;

transition: opacity 0.5s;
}

.relationship {
will-change: transform;

transition: opacity 0.5s;
cursor: default;

Expand Down

0 comments on commit 84f5bff

Please sign in to comment.