Spaces:
Sleeping
Sleeping
Update app.py
#9
by
singhn9
- opened
app.py
CHANGED
|
@@ -257,14 +257,24 @@ function focusNode(nodeName){{
|
|
| 257 |
if(t===idx) keep.add(s);
|
| 258 |
}}
|
| 259 |
|
| 260 |
-
|
|
|
|
| 261 |
const N = meta.node_names.length;
|
| 262 |
-
const
|
| 263 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
-
Plotly.restyle(container,{{
|
| 266 |
-
"marker.opacity":[op]
|
| 267 |
-
}}, [nodeTraceIndex]);
|
| 268 |
|
| 269 |
// edges
|
| 270 |
for(let e=0;e<edgeCount;e++){{
|
|
@@ -284,7 +294,15 @@ function resetView(){{
|
|
| 284 |
const N=meta.node_names.length;
|
| 285 |
const op=Array(N).fill(1.0);
|
| 286 |
|
| 287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
|
| 289 |
for(let e=0;e<edgeCount;e++){{
|
| 290 |
Plotly.restyle(container,{{
|
|
|
|
| 257 |
if(t===idx) keep.add(s);
|
| 258 |
}}
|
| 259 |
|
| 260 |
+
|
| 261 |
+
// Update nodes (hide others + hide their labels)
|
| 262 |
const N = meta.node_names.length;
|
| 263 |
+
const nodeOp = Array(N).fill(0.0);
|
| 264 |
+
const textColors = Array(N).fill("rgba(0,0,0,0)");
|
| 265 |
+
|
| 266 |
+
for (let i = 0; i < N; i++) {
|
| 267 |
+
if (keep.has(i)) {
|
| 268 |
+
nodeOp[i] = 1.0;
|
| 269 |
+
textColors[i] = "black"; // visible label
|
| 270 |
+
}
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
Plotly.restyle(container, {
|
| 274 |
+
"marker.opacity": [nodeOp],
|
| 275 |
+
"textfont.color": [textColors]
|
| 276 |
+
}, [nodeTraceIndex]);
|
| 277 |
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
// edges
|
| 280 |
for(let e=0;e<edgeCount;e++){{
|
|
|
|
| 294 |
const N=meta.node_names.length;
|
| 295 |
const op=Array(N).fill(1.0);
|
| 296 |
|
| 297 |
+
const N = meta.node_names.length;
|
| 298 |
+
const nodeOp = Array(N).fill(1.0);
|
| 299 |
+
const textColors = Array(N).fill("black");
|
| 300 |
+
|
| 301 |
+
Plotly.restyle(container, {
|
| 302 |
+
"marker.opacity":[nodeOp],
|
| 303 |
+
"textfont.color":[textColors]
|
| 304 |
+
}, [nodeTraceIndex]);
|
| 305 |
+
|
| 306 |
|
| 307 |
for(let e=0;e<edgeCount;e++){{
|
| 308 |
Plotly.restyle(container,{{
|