const graphOut = ref(null);
const optionGraph= reactive({
series: [
{
type: 'graph',
shape: 'circle',
symbolSize: [215, 50],
//散点形状设置symbol: 'circle’, ‘rect’, ‘roundRect’, ‘triangle’, ‘diamond’, ‘pin’, 'arrow’
symbol: 'rect',
layout: 'force',
force: {
repulsion: 85,// 节点之间的斥力因子
edgeLength: 85, //边的两个节点之间的距离
layoutAnimation: true,
friction: 0.3
},
label: {
normal: {
show: true,
formatter: '{b}',
color: '#BFD5E8',
textStyle: {
fontSize: '14',
},
},
},
roam: false,
draggable: false,
data: data
}
]
})
onMounted(() => {
const myChars = echarts.init(graphOut.value);
myChars.setOption(optionGraph);
myChars.on('click', (params: unknown) => {
console.log('com-click', params);
console.log('com-click', params.data.id);
// let myArayy = toRaw(optionGraph.series)
// myChars.setOption(optionGraph);
});
});
<div class="graph_box">
<div id="graph_out" ref="graphOut"></div>
</div>