I write this code in https://echarts.apache.org/examples/zh/editor.html?c=graph-simple
option = {
series: [
{
type: 'graph',
layout: 'force',
roam: true,
force: {
repulsion: 100
},
data: [{
x: null,
y: null
}, {
x: null,
y: null
}, {
x: null,
y: null
}, {
x: null,
y: null
}],
}
]
};
myChart.on('click', function (params) {
if (params.componentType === 'series') {
if (params.componentSubType === 'graph') {
option.series[0].layout = 'none'
const graphNodes = myChart._chartsMap["_ec_\u0000series\u00000\u00000_series.graph"]._symbolDraw._data.graph.data._graphicEls
for (let i = 0; i < graphNodes.length; i ++ ) {
option.series[0].data[i].x = graphNodes[i].x
option.series[0].data[i].y = graphNodes[i].y
}
myChart.setOption(option)
}
}
});
myChart.setOption(option);
but when click on the node, position is not correct.
echarts version is 5.0.2.