Skip to content

Commit 39f013a

Browse files
committed
Add pagination to split large graph visualizations
1 parent 98ed65c commit 39f013a

File tree

8 files changed

+969
-66
lines changed

8 files changed

+969
-66
lines changed

graph-visualization/artifactDependenciesGraph/artifactDependenciesGraph.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
<link rel="stylesheet" href="./../index.css">
1212
<script src="./../node_modules/neovis.js/dist/neovis.js"></script>
13+
<script type="text/javascript" src="./../vis-configuration-presets.js"></script>
14+
<script type="text/javascript" src="./../visualization-pagination.js"></script>
1315
<script type="text/javascript" src="artifactDependenciesGraph.js"></script>
1416
</head>
1517

@@ -19,7 +21,7 @@
1921
<input type="password" id="neo4j-server-password" name="neo4j-server-password" />
2022
<input type="submit" id="neo4j-server-login" value="Login" onClick="draw()" />
2123
</span>
22-
<div id="viz"></div>
24+
<div id="visualizations"></div>
2325
</body>
2426

2527
</html>
Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,31 @@
1-
function draw() {
2-
const config = {
3-
containerId: "viz",
4-
neo4j: {
5-
serverUrl: "bolt://localhost:7687",
6-
serverUser: "neo4j",
7-
serverPassword: document.getElementById("neo4j-server-password").value || "neo4jinitial",
8-
},
9-
visConfig: {
10-
nodes: {
11-
shape: "hexagon",
12-
shadow: false,
13-
font: {
14-
strokeWidth: 40,
15-
strokeColor: "#F2F2FF",
16-
},
17-
size: 60,
18-
},
19-
edges: {
20-
arrows: {
21-
to: { enabled: true },
22-
},
23-
scaling: {
24-
max: 15,
25-
},
26-
},
27-
physics: {
28-
hierarchicalRepulsion: {
29-
nodeDistance: 300, // 100
30-
centralGravity: 0.5, // 0.2
31-
springLength: 180, // 200
32-
springConstant: 0.06, // 0.05
33-
damping: 0.09, // 0.09
34-
avoidOverlap: 0.1, // 0
35-
},
36-
solver: "hierarchicalRepulsion", // barnesHut
37-
},
38-
layout: {
39-
hierarchical: {
40-
enabled: true,
41-
sortMethod: "directed",
42-
},
43-
},
44-
},
1+
function getNeo4jCredentials() {
2+
return {
3+
serverUrl: "bolt://localhost:7687",
4+
serverUser: "neo4j",
5+
serverPassword: document.getElementById("neo4j-server-password").value,
6+
};
7+
}
8+
9+
function getConfiguration(containerId = "viz", credentials, visConfiguration) {
10+
return {
11+
containerId: containerId,
12+
neo4j: credentials,
13+
visConfig: visConfiguration,
4514
labels: {
4615
Artifact: {
4716
[NeoVis.NEOVIS_ADVANCED_CONFIG]: {
4817
function: {
4918
// Print all properties for the title (when nodes are clicked)
5019
title: NeoVis.objectToTitleHtml,
51-
// Use "fileName" as label. Remove leading slash, trailing ".jar" and version number.
20+
// Use "fileName" as label. Remove leading slash, trailing ".jar", version number and a trailing word like "Final".
5221
label: (node) =>
5322
node.properties.fileName
5423
.replace("/", "")
5524
.replace(".jar", "")
56-
.replace(/-[\d\\.]+/, ""),
25+
.replace(/[\d\.\-\_v]+\w+$/gm, "") +
26+
"(" +
27+
node.properties.maxDistanceFromSource +
28+
")",
5729
},
5830
},
5931
},
@@ -64,9 +36,12 @@ function draw() {
6436
value: "weight",
6537
},
6638
},
67-
initialCypher: "MATCH (s:Artifact)-[r:DEPENDS_ON]->(d:Artifact) RETURN s,r,d",
39+
initialCypher:
40+
"MATCH (a1:Artifact)-[r1:DEPENDS_ON*0..1]->(a2:Artifact) WHERE a1.topologicalSortIndex >= 0 AND a2.topologicalSortIndex >= 0 AND a1 <> a2 RETURN a1,r1,a2 ORDER BY a2.topologicalSortIndex, a1.topologicalSortIndex SKIP toInteger($startIndex) LIMIT toInteger($blockSize)",
6841
};
42+
}
6943

70-
const neoViz = new NeoVis.default(config);
71-
neoViz.render();
44+
function draw() {
45+
const config = getConfiguration("viz", getNeo4jCredentials(), hierarchicalHexagons());
46+
paginatedGraphVisualization({containerElementId: "visualizations", neoVizConfiguration: config});
7247
}

graph-visualization/index.css

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
div {
2-
width: 75vw;
2+
width: 100vw;
33
height: 100vh;
4-
/*border: 1px solid lightgray;*/
5-
}
4+
}
5+
6+
.indexedVisualization {
7+
margin-top: 10px;
8+
margin-left: 10px;
9+
width: 400vw;
10+
height: 400vh;
11+
display:inline-block;
12+
}
13+
14+
.indexedVisualization.visualization-finished {
15+
border-width: 1px;
16+
border-style: solid;
17+
border-color: lightgreen;
18+
}
19+
20+
.indexedVisualization:not(.visualization-finished) {
21+
border-width: 2px;
22+
border-style: dotted;
23+
border-color: orange;
24+
}
25+
26+
.indexedVisualization.visualization-finished.visualization-failed {
27+
height: 6em;
28+
border-width: 2px;
29+
border-style: solid;
30+
border-color: red;
31+
}

0 commit comments

Comments
 (0)