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