sai111 opened a new issue #8450: 动态嵌套饼图时, Cannot read property 'startAngle' of undefined URL: https://github.com/apache/incubator-echarts/issues/8450 <!-- 为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。 --> ### One-line summary [问题简述] 动态嵌套饼图,使用onmouseover 经过外层饼图,内层饼图动态发生变化,出现 PieView.js:38 Uncaught TypeError: Cannot read property 'startAngle' of undefined at toggleItemSelected (PieView.js:38) at PiePiece.webpackJsonp../node_modules/[email protected]@echarts/lib/chart/pie/PieView.js.piePieceProto.updateData (PieView.js:126) at DataDiffer._update (PieView.js:256) at DataDiffer.execute (DataDiffer.js:76) at ExtendedClass.render (PieView.js:264) at Task.progress [as _progress] (Chart.js:228) at Task.webpackJsonp../node_modules/[email protected]@echarts/lib/stream/task.js.taskProto.perform (task.js:89) at echarts.js:1330 at ExtendedClass.<anonymous> (Global.js:479) at Array.forEach (<anonymous>) 具体代码 function toggleItemSelected(el, layout, isSelected, selectedOffset, hasAnimation) { var midAngle = (layout.startAngle + layout.endAngle) / 2; **这里出现问题 Cannot read property 'startAngle' of undefined** var dx = Math.cos(midAngle); var dy = Math.sin(midAngle); var offset = isSelected ? selectedOffset : 0; var position = [dx * offset, dy * offset]; hasAnimation // animateTo will stop revious animation like update transition ? el.animate().when(200, { position: position }).start('bounceOut') : el.attr('position', position); } ### Version & Environment [版本及环境] + ECharts version [ECharts 版本]: + Browser version [浏览器类型和版本]: + OS Version [操作系统类型和版本]: echarts 版本 4.0.4 浏览器 chroom 11 window10 ### Expected behaviour [期望结果] 不再出现找不到 startAngle undefined ### ECharts option [ECharts配置项] <!-- Copy and paste your 'echarts option' here. --> <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] --> ```javascript this.chart.on("mouseover", function(params) { if (params.seriesName === "外层的数据") { var id = params.data.id _this.patrol_pie_problem.series[0].data = _this.dispatch_finish[id] _this.chart.setOption({ ...patrol_pie_problem }) } }) const CommonColor = [ "#1668FF", "#4974FF", "#299EFF", "#29CAFF", "#00FFFF", "#FF9711", "#FFD34E", "#FFE44E", "#F0FF4E" ] option = { title: { text: "", left: "center", top: 20, textStyle: { color: "#fff", align: "right" } }, tooltip: { trigger: 'item', formatter: "{a} <br/>{b}: {c} ({d}%)", }, legend: { show: true, type: 'scroll', data: [], selected: true, bottom: 20, left: 10, right: 10, pageIconColor: '#299eff', pageIconInactiveColor: '#299eff', pageIconSize: 10, pageTextStyle: { fontSize: 10, color: '#fff', }, textStyle: { color: "#fff", fontSize: '10' }, color: CommonColor }, series: [ { color: ["#4974FF", "#299EFF"], name: '完成率', type: 'pie', radius: [0, '30%'], label: { normal: { position: 'inner' } }, labelLine: { normal: { show: false } }, data: [] }, { color: CommonColor, name: '公司', type: 'pie', radius: ['40%', '55%'], label: { normal: { show: false }, emphasis: { show: true } }, data: [] } ] } ``` ### Other comments [其他信息] <!-- For example: Screenshot or Online demo --> <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
