通过客户端宏,让地图的高亮效果可以循环跳动,如下图所示:
效果如下:
把下面宏代码复制到代码区域;
// 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) |