function main(page: IPage, portlet: IEChartsPortlet) {
// console.log('portlet: ', portlet)
// console.log('chartInstance: ', portlet.getChartInstance())
let options = portlet.getChartOptions() //获取组件对象
let data = options.series[0].data
let count = data.length
let chartInstance = portlet.getChartInstance()
let curIndex = 0
let lastIndex = -1
let interval = setInterval(function () { // 定时器,但是没关
try {
// console.log('curIndex: ', curIndex)
// console.log('lastIndex: ', lastIndex)
if (lastIndex != -1) {
chartInstance.dispatchAction({
type: 'downplay',
dataIndex: lastIndex
});
}
chartInstance.dispatchAction({
type: 'highlight',
dataIndex: curIndex
});
lastIndex = curIndex
curIndex++
if (curIndex >= count) {
curIndex = 0
}
} catch (e) {
console.error('e: ', e)
clearInterval(interval)
}
}, 1500)
}