{"action":"created","issue":{"url":"https://api.github.com/repos/ecomfe/echarts/issues/3111","repository_url":"https://api.github.com/repos/ecomfe/echarts","labels_url":"https://api.github.com/repos/ecomfe/echarts/issues/3111/labels{/name}","comments_url":"https://api.github.com/repos/ecomfe/echarts/issues/3111/comments","events_url":"https://api.github.com/repos/ecomfe/echarts/issues/3111/events","html_url":"https://github.com/ecomfe/echarts/issues/3111","id":151602469,"number":3111,"title":"echarts3.0中，tooltip参数的formatter回调函数的形参与图形实例的option中的series及legend数据不一致","user":{"login":"bo2337285","id":10010039,"avatar_url":"https://avatars.githubusercontent.com/u/10010039?v=3","gravatar_id":"","url":"https://api.github.com/users/bo2337285","html_url":"https://github.com/bo2337285","followers_url":"https://api.github.com/users/bo2337285/followers","following_url":"https://api.github.com/users/bo2337285/following{/other_user}","gists_url":"https://api.github.com/users/bo2337285/gists{/gist_id}","starred_url":"https://api.github.com/users/bo2337285/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bo2337285/subscriptions","organizations_url":"https://api.github.com/users/bo2337285/orgs","repos_url":"https://api.github.com/users/bo2337285/repos","events_url":"https://api.github.com/users/bo2337285/events{/privacy}","received_events_url":"https://api.github.com/users/bo2337285/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-28T10:23:55Z","updated_at":"2016-04-29T09:16:45Z","closed_at":null,"body":"<!--\r\n为了方便我们能够复现和修复 bug，请遵从下面的规范描述您的问题。\r\n-->\r\n#### 问题简述 (One-line summary)\r\necharts3.0中，tooltip参数的formatter回调函数的形参与图形实例的option中的series及legend数据不一致\r\n\r\n\r\n#### 版本及环境 (Version & Environment)\r\n+ ECharts 版本 (ECharts version): 3.1.2\r\n+ 浏览器类型和版本 (Browser version): chrome 47.0.2526.106 m\r\n+ 操作系统类型和版本 (OS Version): windows7\r\n\r\n\r\n#### 重现步骤 (Steps to reproduce)\r\n1. 创建图表参数，初始化折线图，此时参数中的series为[]\r\n2. ajax获取数据后，把图表参数深拷贝成新对象，并且构建并插入legend和series\r\n3. 获取图表实例，通过setOptions函数传入新图表参数，更新图表内容  ``p.s. 其中参数中的tooltip[0].formartter指向的是功能模块js中声明的一个函数``\r\n4. 此时发现legend显示的个数与实例中option的legend[0].data长度不一致。``p.s. 少了第一项，其他项都存在并且与series一致``\r\n5. 同时tooltips中返回的params(第一个形参)数据集合，其中的第0条数据的seriseName与原option.series[0].name也不一致。params[0].seriseName统一都变为'汇总'了。\r\n\r\n#### 期望结果 (Expected behaviour)\r\ntooltips中的params，option中的series及legend数据应该一致\r\n\r\n\r\n#### 可能哪里有问题 (What went wrong)\r\n1. legend数据不一致肯定问题出在legend渲染上了\r\n2. tooltip中formatter形参不一致个人觉得问题出在形参上，tooltips中把第一项的seriesName替换成了'汇总'这点感觉很怪异，因为我们数据中并没有这个字符串。\r\n\r\n\r\n#### ECharts配置项 (ECharts option)\r\n<!-- 下方贴你的option，注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。\r\n最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing\r\n-->\r\n```javascript\r\noption = {\r\n\r\n}\r\n\r\n```\r\n\r\n\r\n#### 其他信息 (Other comments)\r\n<!-- 例如，截图或线上实例 (JSFiddle/JSBin/Codepen) (For example: Screenshot or Online demo) -->\r\n由于公司网络限制，图片上传不上去\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ecomfe/echarts/issues/comments/215666100","html_url":"https://github.com/ecomfe/echarts/issues/3111#issuecomment-215666100","issue_url":"https://api.github.com/repos/ecomfe/echarts/issues/3111","id":215666100,"user":{"login":"bo2337285","id":10010039,"avatar_url":"https://avatars.githubusercontent.com/u/10010039?v=3","gravatar_id":"","url":"https://api.github.com/users/bo2337285","html_url":"https://github.com/bo2337285","followers_url":"https://api.github.com/users/bo2337285/followers","following_url":"https://api.github.com/users/bo2337285/following{/other_user}","gists_url":"https://api.github.com/users/bo2337285/gists{/gist_id}","starred_url":"https://api.github.com/users/bo2337285/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bo2337285/subscriptions","organizations_url":"https://api.github.com/users/bo2337285/orgs","repos_url":"https://api.github.com/users/bo2337285/repos","events_url":"https://api.github.com/users/bo2337285/events{/privacy}","received_events_url":"https://api.github.com/users/bo2337285/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T09:16:45Z","updated_at":"2016-04-29T09:16:45Z","body":"问题解决了，通过实例setOption()时方法并不会完全更新图表内容，必须得先clear()之后才把上次渲染内容清除干净"}}