lizi 2 years ago
parent
commit
0ca25e9cb1
1 changed files with 25 additions and 4 deletions
  1. 25 4
      src/views/knowledgeGraph/KnowledgeGraphView.vue

+ 25 - 4
src/views/knowledgeGraph/KnowledgeGraphView.vue

@@ -133,16 +133,16 @@ function initGraph(width: number, height: number) {
     },
     nodeStateStyles: {
       selected: {
-        stroke: '#FF8000',
-        fill: '#FF8000',
+        stroke: '#00FA9A',
+        fill: '#00FA9A',
       },
     },
     defaultNode: {
       size: 64,
       type: 'circle',
       style: {
-        stroke: '#FF8000',
-        fill: '#FF8000',
+        stroke: '#90EE90',
+        fill: '#90EE90',
       },
       // 选中颜色为 #FBEECD
       labelCfg: {
@@ -192,6 +192,27 @@ onMounted(() => {
   const rect = document.getElementById("graph")?.getBoundingClientRect()
   if (rect) {
     graph = initGraph(rect.width, rect.height)
+    graph.node((node) => {
+      console.log(node,"node")
+      if (node.label === "建筑工程" || node.label === "工程设计") {
+        return {
+          style: {
+            fill: "#FF8000",
+            stroke: "#FF8000",
+          }
+        };
+      }
+      return {
+        style: {
+          fill: "#00FA9A",
+          stroke: "#00FA9A",
+        },
+      };
+      
+    });
+
+
+    console.log(graph,"graph")
     findName(keyword.value)
   }
 });