Closed Jackwew closed 3 months ago
@Jackwew It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
Found the problem
// good
let currentIndex = -1;
setInterval(function() {
var dataLen = option.series[0].data.length;
// 取消之前高亮的图形
myChart.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: currentIndex
});
currentIndex = (currentIndex + 1) % dataLen;
// 高亮当前图形
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: currentIndex
});
// 显示 tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: currentIndex
});
}, 1000);
// bad
var dataLen = option.series[0].data.length;
// 取消之前高亮的图形
myChart.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: 1
});
// 高亮当前图形
myChart.dispatchAction({
type: 'highlight',
seriesIndex: 0,
dataIndex: 1
});
// 显示 tooltip
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: 1
});
Why do errors occur when setting the first or other dataindexes separately? Can someone help me solve this problem?
你是 setOption 之后,立即调用 dispatchAction 吗?需要等一下,比如加上一个 setTimeout(() => { // ... }, 0)。
你是 setOption 之后,立即调用 dispatchAction 吗?需要等一下,比如加上一个 setTimeout(() => { // ... }, 0)。
不是的,我是在echarts渲染完成后调用高亮函数的
贴下代码片段,看看怎么写的。
This issue is closed due to not being active. Please feel free to open it again (for the author) or create a new one and reference this (for others) if you have further questions.
Version
5.5.0
Link to Minimal Reproduction
5.5.0
Steps to Reproduce
Current Behavior
5.5.0版本无法进行手动高亮饼图,其他图没有问题
当seriesIndex 设置为0时会报错 信息如下:
Expected Behavior
期待正常高亮饼图
Environment
Any additional comments?
No response