类别: "+e.class,shouldUpdate:e=>!0},{type:"edge-tooltip",formatText:e=>"边:"+e.source+"->"+e.target+"
值: "+e.weight,shouldUpdate:e=>!0}]},plugins:[toolbar],fitCenter:!0,fitView:!0}),main=async()=>{const e=await fetch("https://gw.alipayobjects.com/os/basement_prod/6cae02ab-4c29-44b2-b1fd-4005688febcb.json"),t=await e.json();console.log(t);const a=t.nodes,l=t.edges;a.forEach(e=>{switch(e.style||(e.style={}),e.style.lineWidth=1,e.style.stroke="#666",e.style.fill="steelblue",e.class){case"c0":e.type="circle",e.style.fill="red";break;case"c1":e.type="rect";break;case"c2":e.type="ellipse"}}),l.forEach(e=>{}),graph.data(t),graph.render(),graph.on("node:mouseenter",e=>{const t=e.item;graph.setItemState(t,"hover",!0)}),graph.on("node:mouseleave",e=>{const t=e.item;graph.setItemState(t,"hover",!1)}),graph.on("node:click",e=>{graph.findAllByState("node","click").forEach(e=>{graph.setItemState(e,"click",!1)});const t=e.item;graph.setItemState(t,"click",!0)}),graph.on("edge:click",e=>{graph.findAllByState("edge","click").forEach(e=>{graph.setItemState(e,"click",!1)});const t=e.item;graph.setItemState(t,"click",!0)})};main()