dataZoom:[
{
type: "slider",
realtime: true, // 拖動(dòng)時(shí),是否實(shí)時(shí)更新系列的視圖
startValue: arr.length,
endValue: arr.length>5?arr.length-5:0,
width: 10,
height: "90%",
top: "5%",
right: 10,
yAxisIndex: [0, 1], // 控制y軸滾動(dòng)對(duì)象
fillerColor: "#0093ff", // 滾動(dòng)條顏色
borderColor: "rgba(17, 100, 210, 0.12)",
backgroundColor: "#cfcfcf", //兩邊未選中的滑動(dòng)條區(qū)域的顏色
handleSize: 0, // 兩邊手柄尺寸
showDataShadow: false, //是否顯示數(shù)據(jù)陰影 默認(rèn)auto
showDetail: false, // 拖拽時(shí)是否展示滾動(dòng)條兩側(cè)的文字
zoomLock: true,
brushSelect:false,
moveHandleStyle: {
opacity: 0,
},
}
]
//解決label更新不及時(shí)文字錯(cuò)位問題
let times = null;
myChart.on('datazoom', function (event) {
if(times){
clearTimeout(times);
}
setTimeout(() => {
myChart.resize();
}, 2000); //echarts默認(rèn)動(dòng)畫時(shí)長(zhǎng)2000 這里設(shè)置為動(dòng)畫時(shí)長(zhǎng)
});
設(shè)置myChart.resize()衙荐,滾動(dòng)數(shù)據(jù)label文字顯示正常