Closed zonday closed 5 years ago
In this issue, I have provided information with: 在这个 issue 中我提供了以下信息:
点击图表某个bar或者pie某块 动态设置itemStyle的color 不生效,多次快速点击可能会有变化
var data= [ {value:335, name:'直接访问', id: 1, color: 'red', itemStyle: {color: 'red'}}, {value:310, name:'邮件营销', id: 2, color: 'green', itemStyle: {color: 'green'}}, ]; option = { legend: { orient: 'vertical', x: 'left', data:['直接访问','邮件营销'] }, series: [ { name:'访问来源', type:'pie', radius: ['50%', '70%'], hoverAnimation: false, avoidLabelOverlap: false, label: { normal: { show: false, position: 'center' }, emphasis: { show: true, textStyle: { fontSize: '30', fontWeight: 'bold' } } }, labelLine: { normal: { show: false } }, data: data, } ] }; myChart.on('click', "series.pie", function (param) { option.data = data.map(d => { const newD = Object.assign({}, d); d.itemStyle = {color: d.color}; if (d.id === param.data.id) { d.itemStyle.color = 'yellow'; } return newD; }); myChart.setOption(option); });
4.1.0 版本是正常的
ECharts version;ECharts 版本: 4.2.0-rc.2
[ ] It happens only on certain browsers or operating systems. 对于特定浏览器或操作系统才会出现的问题,请提供相应环境信息:{BROWSER_VERSION_OR_OS_INFORMATION_HERE}
d.itemStyle.normal.color = 'yellow';
It seems to be a bug.
Fixed and will be released in 4.2.0-rc.3.
Oh, find it half day, It's here. It has been tested and fixed, thank you!
General Questions
In this issue, I have provided information with: 在这个 issue 中我提供了以下信息:
Issue Type
Issue Details
点击图表某个bar或者pie某块 动态设置itemStyle的color 不生效,多次快速点击可能会有变化
Expected Behavior
Current Behavior
Online Example
4.1.0 版本是正常的
Topics
Anything Else We Need to Know
Environment
ECharts version;ECharts 版本: 4.2.0-rc.2
[ ] It happens only on certain browsers or operating systems. 对于特定浏览器或操作系统才会出现的问题,请提供相应环境信息:{BROWSER_VERSION_OR_OS_INFORMATION_HERE}