feat:高亮节点方法
This commit is contained in:
		
							parent
							
								
									8dfb03c4a1
								
							
						
					
					
						commit
						339e4507a9
					
				| 
						 | 
					@ -6,7 +6,7 @@
 | 
				
			||||||
</script> -->
 | 
					</script> -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div style="width: 100%; height: 100%">
 | 
					  <div style="width: 100%; height: 100%;">
 | 
				
			||||||
    <div class="graph-box" id="graph-container"></div>
 | 
					    <div class="graph-box" id="graph-container"></div>
 | 
				
			||||||
    <div class="slider-box">
 | 
					    <div class="slider-box">
 | 
				
			||||||
      <el-slider v-model="state.sliderValue" @input="sliderChange" :marks="state.marks" />
 | 
					      <el-slider v-model="state.sliderValue" @input="sliderChange" :marks="state.marks" />
 | 
				
			||||||
| 
						 | 
					@ -137,6 +137,30 @@ const createGraph = (data) => {
 | 
				
			||||||
  state.graph = graph
 | 
					  state.graph = graph
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 高亮节点
 | 
				
			||||||
 | 
					 * @param id 节点id
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					const highlightNode = (id) => {
 | 
				
			||||||
 | 
					  state.graph.getNodes().forEach((node) => {
 | 
				
			||||||
 | 
					    state.graph.clearItemStates(node, "selected");
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					  let node = state.graph.findById(id);
 | 
				
			||||||
 | 
					  state.graph.updateItem(node, {
 | 
				
			||||||
 | 
					    size: 80,
 | 
				
			||||||
 | 
					    labelCfg: {
 | 
				
			||||||
 | 
					      style: {
 | 
				
			||||||
 | 
					        fill: "red",
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    style: {
 | 
				
			||||||
 | 
					      stroke: "blue",
 | 
				
			||||||
 | 
					      fill: "yellow",
 | 
				
			||||||
 | 
					      shadowBlur: 10,
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
onMounted(() => {
 | 
					onMounted(() => {
 | 
				
			||||||
  getData('2024-01-03')
 | 
					  getData('2024-01-03')
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user