Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

树图重新载入数据时报错 #7363

Closed
dongwenting opened this Issue Dec 26, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@dongwenting
Copy link

dongwenting commented Dec 26, 2017

One-line summary [问题简述]

需要重新载入数据,新的数据比原来的数据少,报错如下:

default

echarts.js中:

        data.diff(oldData)
            .add(function (newIdx) {
                if (symbolNeedsDraw$1(data, newIdx)) {
                    // create node and edge
                    updateNode(data, newIdx, null, group, seriesModel, seriesScope);
                }
            })
            .update(function (newIdx, oldIdx) {
                var symbolEl = oldData.getItemGraphicEl(oldIdx);
                if (!symbolNeedsDraw$1(data, newIdx)) {
                    symbolEl && removeNode(data, newIdx, symbolEl, group, seriesModel, seriesScope);
                    return;
                }
                // update  node and edge
                updateNode(data, newIdx, symbolEl, group, seriesModel, seriesScope);
            })
            .remove(function (oldIdx) {
                var symbolEl = oldData.getItemGraphicEl(oldIdx);
     //这里传入新的data和老的oldIdx
                removeNode(data, oldIdx, symbolEl, group, seriesModel, seriesScope);
            })
            .execute();

function removeNode(data, dataIndex, symbolEl, group, seriesModel, seriesScope) {
   //新的data数据少,返回的node等于undefined,因此getModel出错
    var node = data.tree.getNodeByDataIndex(dataIndex);
    var virtualRoot = data.tree.root;
    var itemModel = node.getModel();

Version & Environment [版本及环境]

  • ECharts version [ master刚下的,3.8.4]: 建议在echarts.min.js上加版本
  • Browser version [firefox 57.02,chrome 63.0]:
  • OS Version [window 7专业版]:

Expected behaviour [期望结果]

ECharts option [ECharts配置项]

option = {

}

Other comments [其他信息]

@dongwenting

This comment has been minimized.

Copy link
Author

dongwenting commented Dec 26, 2017

找到解决办法了,先clear一下,再重载
myChart.clear();

@deqingli deqingli closed this Apr 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.