feat:高亮节点方法

This commit is contained in:
wjf 2025-06-18 15:15:19 +08:00
parent 8dfb03c4a1
commit 339e4507a9
2 changed files with 26 additions and 2 deletions

2
package-lock.json generated
View File

@ -3100,4 +3100,4 @@
"license": "0BSD"
}
}
}
}

View File

@ -6,7 +6,7 @@
</script> -->
<template>
<div style="width: 100%; height: 100%">
<div style="width: 100%; height: 100%;">
<div class="graph-box" id="graph-container"></div>
<div class="slider-box">
<el-slider v-model="state.sliderValue" @input="sliderChange" :marks="state.marks" />
@ -137,6 +137,30 @@ const createGraph = (data) => {
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(() => {
getData('2024-01-03')
})