79189082

Date: 2024-11-14 14:07:09
Score: 0.5
Natty:
Report link

I know this is old, but stumbled here when googling for the issue. The approach mentioned by @Ch'nycos actually works here:

One can use the 'finished' event to turn the positions into static coordinates. So the basic approach (we use this in a Vue-Echarts setting, so all the 'this' references refer to the Vue component data):

on_finished: function() {
    // getting the coordinate data from the rendered graph:
    const model = this.chart.getModel()
    const series = model.getSeriesByIndex(0);
    const nodeData = series.getData();
    
    // set the active layout to 'none' to avoid force updating:
    this.active_layout = 'none'
    
    // loop over node data to set the coordinates to the fixed node Data
    this.graph_data.nodes.forEach((node, nodenum) => {
      [node.x, node.y] = nodeData.getItemLayout(nodenum)
    })
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Ch'nycos
  • Low reputation (0.5):
Posted by: T. Altena