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}
0 commit comments