(d)
| 67 | } |
| 68 | |
| 69 | export function getNodeRadius(d) { |
| 70 | let minScore = Infinity, maxScore = -Infinity; |
| 71 | let minR = 10, maxR = 32; |
| 72 | const metric = getSelectedMetric(); |
| 73 | |
| 74 | if (Array.isArray(allNodeData) && allNodeData.length > 0) { |
| 75 | allNodeData.forEach(n => { |
| 76 | if (n.metrics && typeof n.metrics[metric] === "number") { |
| 77 | if (n.metrics[metric] < minScore) minScore = n.metrics[metric]; |
| 78 | if (n.metrics[metric] > maxScore) maxScore = n.metrics[metric]; |
| 79 | } |
| 80 | }); |
| 81 | if (minScore === Infinity) minScore = 0; |
| 82 | if (maxScore === -Infinity) maxScore = 1; |
| 83 | } else { |
| 84 | minScore = 0; |
| 85 | maxScore = 1; |
| 86 | } |
| 87 | |
| 88 | let score = d.metrics && typeof d.metrics[metric] === "number" ? d.metrics[metric] : null; |
| 89 | if (score === null || isNaN(score)) { |
| 90 | return minR / 2; |
| 91 | } |
| 92 | if (maxScore === minScore) return (minR + maxR) / 2; |
| 93 | score = Math.max(minScore, Math.min(maxScore, score)); |
| 94 | return minR + (maxR - minR) * (score - minScore) / (maxScore - minScore); |
| 95 | } |
| 96 | |
| 97 | export function selectProgram(programId) { |
| 98 | const nodes = g.selectAll("circle"); |
no test coverage detected