Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -566,8 +566,10 @@ function draw() {
|
|
| 566 |
const allW = [].concat(
|
| 567 |
BUYS.map(x=>x[2]),
|
| 568 |
SELLS.map(x=>x[2]),
|
| 569 |
-
TRANSFERS.map(x=>x[2])
|
|
|
|
| 570 |
);
|
|
|
|
| 571 |
const stroke = d3.scaleLinear()
|
| 572 |
.domain([Math.min(...allW), Math.max(...allW)])
|
| 573 |
.range([1,6]);
|
|
@@ -715,9 +717,14 @@ function draw() {
|
|
| 715 |
let sells = SELLS.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
|
| 716 |
let transfers = TRANSFERS.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
|
| 717 |
let loops = LOOPS.filter(x=>x[0]===nodeName || x[2]===nodeName).map(x=>x[0]===nodeName?x[2]:x[0]);
|
| 718 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 719 |
}
|
| 720 |
|
|
|
|
| 721 |
function updateLabels(selected, connected){
|
| 722 |
labelGroup.text(d => {
|
| 723 |
if (selected && (d.name===selected || connected.has(d.name)))
|
|
@@ -768,13 +775,20 @@ function draw() {
|
|
| 768 |
function showInfo(nodeName){
|
| 769 |
const buys = BUYS.filter(x => x[0] === nodeName || x[1] === nodeName)
|
| 770 |
.map(x => x[0] === nodeName ? x[1] : x[0]);
|
|
|
|
| 771 |
const sells = SELLS.filter(x => x[0] === nodeName || x[1]===nodeName)
|
| 772 |
.map(x => x[0] === nodeName ? x[1] : x[0]);
|
|
|
|
| 773 |
const transfers = TRANSFERS.filter(x => x[0]===nodeName || x[1]===nodeName)
|
| 774 |
.map(x => x[0]===nodeName ? x[1] : x[0]);
|
|
|
|
| 775 |
const loops = LOOPS.filter(x => x[0]===nodeName || x[2]===nodeName)
|
| 776 |
.map(x => x[0]===nodeName ? x[2] : x[0]);
|
| 777 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 778 |
const box = document.getElementById("info-box");
|
| 779 |
box.innerHTML = `
|
| 780 |
<div style="font-size:14px;"><b>${nodeName}</b></div>
|
|
@@ -782,13 +796,13 @@ function draw() {
|
|
| 782 |
<b>Buys:</b> ${buys.length ? buys.join(", ") : "<span style='color:#777'>None</span>"}<br>
|
| 783 |
<b>Sells:</b> ${sells.length ? sells.join(", ") : "<span style='color:#777'>None</span>"}<br>
|
| 784 |
<b>Transfers:</b> ${transfers.length ? transfers.join(", ") : "<span style='color:#777'>None</span>"}<br>
|
| 785 |
-
<b>Loops:</b> ${loops.length ? loops.join(", ") : "<span style='color:#777'>None</span>"}
|
| 786 |
-
<span style=
|
| 787 |
-
|
| 788 |
</div>
|
| 789 |
`;
|
| 790 |
}
|
| 791 |
|
|
|
|
| 792 |
function selectNode(d){
|
| 793 |
const name = d.name;
|
| 794 |
setOpacityFor(name);
|
|
|
|
| 566 |
const allW = [].concat(
|
| 567 |
BUYS.map(x=>x[2]),
|
| 568 |
SELLS.map(x=>x[2]),
|
| 569 |
+
TRANSFERS.map(x=>x[2]),
|
| 570 |
+
(FRESH ? FRESH.map(x=>x[2]) : [])
|
| 571 |
);
|
| 572 |
+
|
| 573 |
const stroke = d3.scaleLinear()
|
| 574 |
.domain([Math.min(...allW), Math.max(...allW)])
|
| 575 |
.range([1,6]);
|
|
|
|
| 717 |
let sells = SELLS.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
|
| 718 |
let transfers = TRANSFERS.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
|
| 719 |
let loops = LOOPS.filter(x=>x[0]===nodeName || x[2]===nodeName).map(x=>x[0]===nodeName?x[2]:x[0]);
|
| 720 |
+
|
| 721 |
+
// <-- NEW: include FRESH edges so teal arcs behave like real connections
|
| 722 |
+
let fresh = FRESH.filter(x=>x[0]===nodeName || x[1]===nodeName).map(x=>x[0]===nodeName?x[1]:x[0]);
|
| 723 |
+
|
| 724 |
+
return new Set([].concat(buys, sells, transfers, loops, fresh));
|
| 725 |
}
|
| 726 |
|
| 727 |
+
|
| 728 |
function updateLabels(selected, connected){
|
| 729 |
labelGroup.text(d => {
|
| 730 |
if (selected && (d.name===selected || connected.has(d.name)))
|
|
|
|
| 775 |
function showInfo(nodeName){
|
| 776 |
const buys = BUYS.filter(x => x[0] === nodeName || x[1] === nodeName)
|
| 777 |
.map(x => x[0] === nodeName ? x[1] : x[0]);
|
| 778 |
+
|
| 779 |
const sells = SELLS.filter(x => x[0] === nodeName || x[1]===nodeName)
|
| 780 |
.map(x => x[0] === nodeName ? x[1] : x[0]);
|
| 781 |
+
|
| 782 |
const transfers = TRANSFERS.filter(x => x[0]===nodeName || x[1]===nodeName)
|
| 783 |
.map(x => x[0]===nodeName ? x[1] : x[0]);
|
| 784 |
+
|
| 785 |
const loops = LOOPS.filter(x => x[0]===nodeName || x[2]===nodeName)
|
| 786 |
.map(x => x[0]===nodeName ? x[2] : x[0]);
|
| 787 |
+
|
| 788 |
+
// NEW — detect Fresh Buys
|
| 789 |
+
const fresh = FRESH.filter(x => x[0] === nodeName || x[1] === nodeName)
|
| 790 |
+
.map(x => x[0] === nodeName ? x[1] : x[0]);
|
| 791 |
+
|
| 792 |
const box = document.getElementById("info-box");
|
| 793 |
box.innerHTML = `
|
| 794 |
<div style="font-size:14px;"><b>${nodeName}</b></div>
|
|
|
|
| 796 |
<b>Buys:</b> ${buys.length ? buys.join(", ") : "<span style='color:#777'>None</span>"}<br>
|
| 797 |
<b>Sells:</b> ${sells.length ? sells.join(", ") : "<span style='color:#777'>None</span>"}<br>
|
| 798 |
<b>Transfers:</b> ${transfers.length ? transfers.join(", ") : "<span style='color:#777'>None</span>"}<br>
|
| 799 |
+
<b>Loops:</b> ${loops.length ? loops.join(", ") : "<span style='color:#777'>None</span>"}<br>
|
| 800 |
+
<b>Fresh Buys:</b> ${fresh.length ? fresh.join(", ") : "<span style='color:#777'>None</span>"}
|
|
|
|
| 801 |
</div>
|
| 802 |
`;
|
| 803 |
}
|
| 804 |
|
| 805 |
+
|
| 806 |
function selectNode(d){
|
| 807 |
const name = d.name;
|
| 808 |
setOpacityFor(name);
|