|
170 | 170 | if (!edgeSet.has(edgeId)) { |
171 | 171 | edgeSet.add(edgeId); |
172 | 172 | hyperData.edges.push({ |
| 173 | + id: edgeId, |
173 | 174 | source: a, |
174 | 175 | target: b, |
175 | 176 | ...edge, |
|
216 | 217 | key: `bubble-sets-${key}`, |
217 | 218 | type: "bubble-sets", |
218 | 219 | members: nodes, |
| 220 | + keywords: edge.keywords || "", |
| 221 | + summary: edge.summary || "", |
| 222 | + weight: edge.weight || nodes.length, |
219 | 223 | ...createStyle(colors[i % colors.length]), |
220 | 224 | }); |
221 | 225 | } |
|
241 | 245 | .join("; "); |
242 | 246 | result += `<p><strong>Description:</strong> ${desc}</p>`; |
243 | 247 | } |
| 248 | + //展示所有剩余属性 |
| 249 | + Object.entries(item).forEach(([key, value]) => { |
| 250 | + if ( |
| 251 | + key !== "id" && |
| 252 | + key !== "entity_name" && |
| 253 | + key !== "entity_type" && |
| 254 | + key !== "style" && |
| 255 | + key !== "data" && |
| 256 | + key !== "description" |
| 257 | + ) { |
| 258 | + result += `<p><strong>${key}:</strong> ${value}</p>`; |
| 259 | + } |
| 260 | + }); |
244 | 261 | }); |
245 | 262 | return result; |
246 | 263 | }, |
|
322 | 339 | console.log("Clicked node:", itemId); |
323 | 340 | }); |
324 | 341 |
|
325 | | - // 添加节点悬停事件 |
326 | | - graph.on("node:pointerenter", (e) => { |
327 | | - const { itemId } = e; |
328 | | - const node = graph.getNodeData(itemId); |
329 | | - if (node && node.data) { |
330 | | - // 可以在这里显示tooltip |
331 | | - console.log("Node data:", node.data); |
332 | | - } |
333 | | - }); |
334 | | - |
335 | 342 | // 添加窗口大小变化监听 |
336 | 343 | const handleResize = () => { |
337 | 344 | if (graphRef.current && containerRef.current) { |
@@ -493,12 +500,19 @@ <h2 className="text-2xl font-bold text-gray-800 mb-6 flex items-center"> |
493 | 500 | )} |
494 | 501 | </div> |
495 | 502 | <div className="text-sm text-gray-600 flex gap-2 items-center"> |
| 503 | + {vertex.entity_type ? ( |
496 | 504 | <div className="flex items-center"> |
497 | 505 | <span className="font-medium">Type:</span> |
498 | 506 | <span className="ml-2 px-2 py-1 bg-gray-100 rounded text-xs"> |
499 | | - {vertex.entity_type || "Unknown"} |
| 507 | + {vertex.entity_type} |
500 | 508 | </span> |
501 | | - </div> |
| 509 | + </div>) : ( |
| 510 | + <div className="flex items-center"> |
| 511 | + <span className="font-medium">ID:</span> |
| 512 | + <span className="ml-2 px-2 py-1 bg-gray-100 rounded text-xs"> |
| 513 | + {vertex.id} |
| 514 | + </span> |
| 515 | + </div>)} |
502 | 516 | <div className="flex items-center"> |
503 | 517 | <span className="font-medium">Degree:</span> |
504 | 518 | <span className="ml-2 px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs font-semibold"> |
|
0 commit comments