Skip to content

Commit 54ea80d

Browse files
committed
fixup! Add pagination to split large graph visualizations
1 parent 152b2b8 commit 54ea80d

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

graph-visualization/artifactDependenciesGraph/artifactDependenciesGraph.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ function getHierarchicalVisConfiguration() {
1818
},
1919
},
2020
scaling: {
21-
max: 8,
21+
max: 10,
2222
},
2323
},
2424
physics: {
2525
hierarchicalRepulsion: {
26-
nodeDistance: 220, // 100
26+
nodeDistance: 200, // 100
2727
centralGravity: 0.6, // 0.2
2828
springLength: 200, // 200
2929
springConstant: 0.06, // 0.05
@@ -81,16 +81,17 @@ function getConfiguration(containerId, credentials, visConfiguration) {
8181
},
8282
initialCypher:
8383
//"MATCH (a1:Artifact)-[r1:DEPENDS_ON*0..1]->(a2:Artifact) WHERE a2.topologicalSortIndex >= $startIndex AND a2.topologicalSortIndex < $endIndex RETURN a1,r1,a2 ORDER BY a2.topologicalSortIndex",
84-
"MATCH (a1:Artifact)-[r1:DEPENDS_ON*0..1]->(a2:Artifact) WHERE a2.topologicalSortIndex >= 0 RETURN a1,r1,a2 ORDER BY a2.topologicalSortIndex SKIP toInteger($startIndex) LIMIT toInteger($blockSize)",
84+
//"MATCH (a1:Artifact)-[r1:DEPENDS_ON*0..1]->(a2:Artifact) WHERE a2.topologicalSortIndex >= 0 RETURN a1,r1,a2 ORDER BY a2.topologicalSortIndex SKIP toInteger($startIndex) LIMIT toInteger($blockSize)",
85+
"MATCH (a1:Artifact)-[r1:DEPENDS_ON*0..2]->(a2:Artifact) WHERE a2.topologicalSortIndex >= 0 RETURN a1,r1,a2 ORDER BY a2.topologicalSortIndex SKIP toInteger($startIndex) LIMIT toInteger($blockSize)",
8586
};
8687
}
8788

8889
function draw() {
8990
const containerElement = document.getElementById("visualizations");
9091

9192
// Render at most 50 (maxIndex) visualizations. Rendering ends when no query records are left.
92-
const maxVisualizations = 50; //FIXME larger values lead to a bug where "visualization-finished" isn't written
93-
const recordsPerVisualization = 70;
93+
const maxVisualizations = 110; //FIXME larger values lead to a bug where "visualization-finished" isn't written
94+
const recordsPerVisualization = 60;
9495
let finishedVisualizations = 0;
9596

9697
for (let index = 0; index < maxVisualizations; index++) {
@@ -106,7 +107,7 @@ function draw() {
106107
//console.log(`Finished ${finishedVisualizations} visualizations`)
107108
if (finishedVisualizations >= maxVisualizations) {
108109
// All visualizations were completed.
109-
// Wait for 3 seconds until the physics stabilized
110+
// Wait for 5 seconds until the physics stabilized
110111
const containerElementClassList = indexedVisualizationContainer.parentElement.classList;
111112
setTimeout(() => {
112113
containerElementClassList.add("visualization-finished");
@@ -117,9 +118,15 @@ function draw() {
117118
} else {
118119
setTimeout(() => {
119120
neoViz.stabilize();
121+
indexedVisualizationContainer.classList.add("visualization-finished");
122+
// const unfinishedVisualizations = document.querySelectorAll(".indexedVisualization:not(.visualization-finished)");
123+
// if (unfinishedVisualizations === 0) {
124+
// indexedVisualizationContainer.parentElement.add("visualization-finished");
125+
// }
120126
}, 5000);
121127
}
122128
});
123-
neoViz.render(undefined, {blockSize: recordsPerVisualization, startIndex: index * recordsPerVisualization, endIndex: (index + 1) * recordsPerVisualization });
129+
const parameters = {blockSize: recordsPerVisualization, startIndex: index * recordsPerVisualization, endIndex: (index + 1) * recordsPerVisualization };
130+
neoViz.render(undefined, parameters);
124131
}
125132
}

graph-visualization/index.css

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,21 @@ div {
44
}
55

66
.indexedVisualization {
7-
width: 90vw;
7+
max-width: 98vw;
88
height: 100vh;
99
display:inline-block;
10-
border-width: 1px;
10+
/* border-width: 2px;
11+
border-style: dotted;
12+
border-color: orange; */
13+
}
14+
15+
.indexedVisualization.visualization-finished {
1116
border-style: solid;
12-
border-color: green;
17+
border-color: lightgreen;
18+
}
19+
20+
.indexedVisualization:not(.visualization-finished) {
21+
border-width: 2px;
22+
border-style: dotted;
23+
border-color: orange;
1324
}

graph-visualization/renderVisualizations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const camelToKebabCase = (str) => str.replace(/[A-Z]/g, (letter) => `-${letter.t
2525
*/
2626
const takeCanvasScreenshots = async (browser, htmlFilename) => {
2727
const page = await browser.newPage();
28-
await page.setViewport({ width: 10000, height: 6000, isMobile: false, isLandscape: true, hasTouch: false, deviceScaleFactor: 1 });
28+
await page.setViewport({ width: 4000, height: 2400, isMobile: false, isLandscape: true, hasTouch: false, deviceScaleFactor: 1 });
2929

3030
console.log(`Loading ${htmlFilename}`);
3131
await page.goto(`file://${htmlFilename}`);

0 commit comments

Comments
 (0)