-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4331 from GordonSmith/LIT_GRAPH
feat: Add lit-html enabled graph
- Loading branch information
Showing
65 changed files
with
2,052 additions
and
1,132 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,9 @@ | |
} | ||
|
||
#placeholder, | ||
#placeholder2 { | ||
#placeholder1, | ||
#placeholder2, | ||
#placeholder3 { | ||
width: 100%; | ||
height: 500px; | ||
background-color: #fff; | ||
|
@@ -26,103 +28,44 @@ | |
</style> | ||
|
||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@hpcc-js/[email protected]/dist/index.min.js"></script> | ||
|
||
<script type="module"> | ||
import "@hpcc-js/common/font-awesome/css/font-awesome.min.css"; | ||
</script> | ||
</head> | ||
|
||
<body onresize="doResize()"> | ||
<h1>ESM Quick Test</h1> | ||
<div id="placeholder2"></div> | ||
<div id="placeholder1"></div> | ||
<script type="module"> | ||
import { Graph2 } from "./src/index.ts"; | ||
import { Test6 as Test } from "./tests/index.ts"; | ||
|
||
import "@hpcc-js/common/font-awesome/css/font-awesome.min.css"; | ||
|
||
const nodeCount = 500; | ||
|
||
const categories = [ | ||
{ id: 0, imageChar: "fa-user" }, | ||
{ id: 1, imageChar: "fa-home" } | ||
]; | ||
new Test() | ||
.target("placeholder1") | ||
.render() | ||
; | ||
</script> | ||
<h1>ESM Quick Test</h1> | ||
<div id="placeholder2"></div> | ||
<script type="module"> | ||
import { Test1 as Test } from "./tests/index.ts"; | ||
|
||
new Graph2() | ||
.categories(categories) | ||
.data(createData()) | ||
new Test() | ||
.target("placeholder2") | ||
.layout("ForceDirected") | ||
.applyScaleOnLayout(true) | ||
.allowDragging(false) | ||
.render() | ||
; | ||
|
||
function createData() { | ||
const rawData = { | ||
"nodes": Array.from({ length: nodeCount }, (_, i) => { | ||
return { "name": i + 1, "type": "number" } | ||
}), | ||
"links": Array.from({ length: nodeCount }, (_, i) => { | ||
return { "source": Math.floor(Math.sqrt(i)), "target": i }; | ||
}).slice(1) | ||
}; | ||
const vertices = rawData.nodes.map(function (node, idx) { | ||
return { | ||
categoryID: 0, | ||
id: idx, | ||
text: "" + node.name, | ||
textFontFamily: "monospace" | ||
}; | ||
}); | ||
return { | ||
vertices: vertices, | ||
edges: rawData.links.map(function (link, idx) { | ||
return { | ||
id: idx, | ||
source: vertices[link.source], | ||
target: vertices[link.target], | ||
label: link.name, | ||
fontFamily: "monospace" | ||
}; | ||
}), | ||
}; | ||
} | ||
</script> | ||
<div id="placeholder"></div> | ||
<div id="placeholder3"></div> | ||
<script type="module"> | ||
import { SankeyGraph } from "./src/index.ts"; | ||
|
||
import "@hpcc-js/common/font-awesome/css/font-awesome.min.css"; | ||
import { Test3 as Test } from "./tests/index.ts"; | ||
|
||
new SankeyGraph() | ||
.target("placeholder") | ||
.vertexColumns(["category", "id", "label"]) | ||
.vertices([ | ||
[0, 0, "Year 1"], | ||
[0, 1, "Year 2"], | ||
[0, 2, "Year 3"], | ||
[0, 3, "Year 4"], | ||
[1, 4, "Math"], | ||
[1, 5, "English"], | ||
[1, 6, "Geometry"], | ||
[1, 7, "Science"], | ||
]) | ||
.edgeColumns(["source", "target", "weight"]) | ||
.edges([ | ||
[0, 4, 1], | ||
[1, 4, 1], | ||
[2, 4, 1], | ||
[3, 4, 1], | ||
[0, 5, 1], | ||
[1, 5, 1], | ||
[2, 6, 1], | ||
[3, 6, 1], | ||
[1, 7, 1], | ||
[2, 7, 1], | ||
[3, 7, 1], | ||
]) | ||
new Test() | ||
.target("placeholder3") | ||
.render() | ||
; | ||
</script> | ||
<script> | ||
function doResize() { | ||
window.__widget?.resize()?.render(); | ||
} | ||
</script> | ||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.graph_GraphT .graphVertex { | ||
cursor: pointer; | ||
} | ||
|
||
.graph_GraphT .allowDragging .graphVertex { | ||
cursor: pointer; | ||
} | ||
|
||
.graph_GraphT .allowDragging .graphVertex.grabbed { | ||
cursor: grabbing; | ||
} | ||
|
||
.graph_GraphT .graphEdge { | ||
stroke: darkgray; | ||
fill: none; | ||
} | ||
|
||
.graph_GraphT .graphEdge>text { | ||
stroke: none; | ||
fill: black; | ||
} | ||
|
||
.graph_GraphT .graphEdge.hide-text>text { | ||
display: none; | ||
} | ||
|
||
.graph_GraphT g.selected rect { | ||
stroke: navy !important; | ||
} | ||
|
||
.graph_GraphT g.selected circle { | ||
stroke: navy !important; | ||
} |
Oops, something went wrong.