options設置html
toolbox: { // 工具欄
feature: {
dataZoom : { // 選時間縮放功能
show : true, // show爲true時,才能觸發takeGlobalCursor事件
yAxisIndex: 'none',
},
}
}
啓動或關閉 中 的刷選狀態。 echarts對應文檔連接https://echarts.baidu.com/api.html#action.dataZoom.takeGlobalCursortoolboxdataZoom
折線圖html
<ve-line :ref="'lineChart' + i"></ve-line>
經過refs獲取對應下標的echarts圖表
myChart = this.$refs[`lineChart${chartIndex}`][0].echarts
this.$nextTick(() => { // 經過nextTick獲取,防止圖表dom未渲染完成 若是還未激活刷選光標,則嘗試setTimeout(()=>{},1000)選取更長的渲染延時觸發
myChart.dispatchAction({ // 默認啓動 toolbox 中 dataZoom 的刷選狀態 type: "takeGlobalCursor", key: "dataZoomSelect", dataZoomSelectActive: true })})