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

动态改变series的bug #4033

Closed
zombieJ opened this issue Sep 7, 2016 · 5 comments
Closed

动态改变series的bug #4033

zombieJ opened this issue Sep 7, 2016 · 5 comments

Comments

@zombieJ
Copy link

zombieJ commented Sep 7, 2016

问题简述 (One-line summary)

动态改变line chart的series会出现显示错误

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):3.2.3
  • 浏览器类型和版本 (Browser version):chrome latest
  • 操作系统类型和版本 (OS Version):win7

重现步骤 (Steps to reproduce)

  • 生成一个line chart,随后改变series的name无效(改变series的data有效)
  • 生成一个line chart,seires的array设置成无效

期望结果 (Expected behaviour)

可以动态改变series的name,删除series时chart也会动态删除

可能哪里有问题 (What went wrong)

第一次生成chart后series被cache住了。以至于更新series后按照原来的顺序生成。

ECharts配置项 (ECharts option)

option = {
                    tooltip: {trigger: 'axis'},
                    legend: [{
                        data: ["aaa", "bbb", "ccc"]
                    }],
                    xAxis: {
                        type: 'category',
                        data: ["1", "2", "3"]
                    },
                    yAxis: {
                        type: "value"
                    },
                    series: [
                        {
                            name: "aaa",
                            type: "line",
                            stack: "job",
                            areaStyle: {normal: {}},
                            data: [1, 1, 1]
                        },
                        {
                            name: "bbb",
                            type: "line",
                            stack: "job",
                            areaStyle: {normal: {}},
                            data: [1, 1, 1]
                        },
                        {
                            name: "ccc",
                            type: "line",
                            stack: "job",
                            areaStyle: {normal: {}},
                            data: [1, 1, 1]
                        }
                    ]
                };

其他信息 (Other comments)

jsfiddle地址: https://jsfiddle.net/q69ph4ze/

  • 点击Change1测试动态更改series name
  • 点击Change2测试动态更改series list
@pissang
Copy link
Contributor

pissang commented Sep 7, 2016

#3937 (comment)

@ghost
Copy link

ghost commented Sep 10, 2016

好!回头试试

@zombieJ
Copy link
Author

zombieJ commented Jan 10, 2017

@pissang ,jsfiddle里的第二个例子还是没有修复。
减少series数量时,会有残留,导致图形显示不改变。

@henry-fun
Copy link

@zombieJ @pissang 在type: 'bar'的情况下,如果动态减少series的数量,会有残留无法动态更新减少后的series数据,这个问题还没有解决吗?我用的react版本的echart,一直存在这个问题。

@syhyz1990
Copy link

是你的用法不对

setOption有3个属性,setOption(option,notMerge,lazyUpdate);

第二个notMerge默认为false,即默认合并两个数据

解决:设置为true

myChart.setOption(option,true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants