echarts异步加载数据,饼图不自动轮播解决方法
app.currentIndex = -1;
//循环内容
//echarts动态获取数据,饼状图不轮流高亮
//动态获取数据,res.data.resultData这是饼图有多少个数据
var n =res.data.resultData.length;
function loopPie() {
//option.series[0].data.length;
var dataLen = n;
// console.log(dataLen);
// 取消之前高亮的图形
myChart.dispatchAction({
type: "downplay",
seriesIndex: 0,
dataIndex: app.currentIndex
});
app.currentIndex = (app.currentIndex + 1) % dataLen;
// 高亮当前图形
myChart.dispatchAction({
type: "highlight",
seriesIndex: 0,
dataIndex: app.currentIndex
});
}