feat: show popularity score
This commit is contained in:
@@ -67,6 +67,7 @@ export const GraphComponent = () => {
|
||||
}
|
||||
|
||||
function handlePopularity() {
|
||||
popularityLabel(!popularity);
|
||||
setPopularity(!popularity);
|
||||
}
|
||||
|
||||
@@ -122,6 +123,20 @@ export const GraphComponent = () => {
|
||||
}
|
||||
setData({ nodes: data.nodes, edges: newEdges });
|
||||
}
|
||||
|
||||
function popularityLabel(popularity: boolean) {
|
||||
const newNodes = data.nodes;
|
||||
console.log(data.nodes);
|
||||
if (popularity) {
|
||||
newNodes.forEach(
|
||||
(node) => (node.subLabel = `pop.: ${node.data.inDegree.toFixed(1)}`)
|
||||
);
|
||||
} else {
|
||||
newNodes.forEach((node) => (node.subLabel = undefined));
|
||||
}
|
||||
setData({ nodes: newNodes, edges: data.edges });
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (mutuality) colorMatches(false);
|
||||
colorMatches(mutuality);
|
||||
|
Reference in New Issue
Block a user