Skip to content

Commit dd35ad5

Browse files
Merge pull request #16 from refactorfirst/render-node-names-in-force-graph-correctly
Render Node Names in Force Graphs with Correct Name
2 parents e51a53d + 563658a commit dd35ad5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎lib/report-view.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export async function createForceGraph(popupId, containerName, dot) {
162162
graphlibGraph.nodes().forEach(node => {
163163
nodes.push({
164164
id: node,
165+
label: graphlibGraph.node(node).label || node,
165166
color: graphlibGraph.node(node).color || 'white',
166167
neighbors: [],
167168
links: []
@@ -187,7 +188,7 @@ export async function createForceGraph(popupId, containerName, dot) {
187188

188189
const graph = new window.ForceGraph3D(container)
189190
.graphData(gData)
190-
.nodeLabel('id')
191+
.nodeLabel('label')
191192
.width(container.clientWidth)
192193
.height(container.clientHeight);
193194

@@ -206,7 +207,7 @@ export async function createForceGraph(popupId, containerName, dot) {
206207

207208
graph
208209
.nodeThreeObject(node => {
209-
const sprite = new SpriteText(node.id);
210+
const sprite = new SpriteText(node.label);
210211
sprite.material.depthWrite = false;
211212
sprite.color = node.color;
212213
sprite.textHeight = 4;

0 commit comments

Comments
 (0)