Skip to content

保存力引导布局graph options 成JSON,重新setOption 报错 #12357

@travis1111

Description

@travis1111

What problem does this feature solve?

力引导布局完成后,我调用 getOption 方法,得到当前 graph 的 option,保存成 json 文件。然后在另外一个页面用 setOption 把保存的json 传进去,结果出错:

echarts.js:59368 Uncaught TypeError: Cannot read property '__focusNodeAdjacency' of undefined
    at echarts.js:59368
    at Graph.graphProto.eachEdge (echarts.js:57587)
    at ExtendedClass.render (echarts.js:59365)
    at Task.progress (echarts.js:25940)
    at doProgress (echarts.js:24831)
    at Task.taskProto.perform (echarts.js:24754)
    at echarts.js:29844
    at ExtendedClass.<anonymous> (echarts.js:22708)
    at Array.forEach (<anonymous>)
    at each$1 (echarts.js:541)

我的目的是,用echarts graph 的 force layout 先布局一次,得到chart option,然后保存好文件。以后每次显示graph 的时候就省去布局的时间了。

或者怎样转换坐标,用force 布局后,得到的layout 是个二维数组,怎么转换成 x y 坐标,然后保存到原始数据中,如果能做,那这个时候的坐标系应该选什么?

谢谢

What does the proposed API look like?

NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    new-featurependingWe are not sure about whether this is a bug/new feature.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions