dataZoom: [
{
xAxisIndex: 0,
show: true,
type: 'slider',
startValue: 0,
endValue: 4,
moveHandleSize: 6,
fillerColor: '#023661',
borderColor: '#023661',
backgroundColor: '#023661',
left: '10%',
right: '10%',
textStyle: {
color: '#fff'
},
height: '1%'
},
{
type: 'inside',
show: true,
xAxisIndex: [0],
start: 0,
end: 100,
moveOnMouseWheel: false,
preventDefaultMouseMove: false
}
],....
const that = this
const myChartCategory = echarts.init(this.$refs.category1)
myChartCategory.getZr().on('click', params => {
const pointInPixel = [params.offsetX, params.offsetY]
if (myChartCategory.containPixel('grid', pointInPixel)) {
const xIndex = myChartCategory.convertFromPixel({ seriesIndex: 0 }, [params.offsetX, params.offsetY])[0]
this.$router.push(‘/xxx’)
}
})
myChartCategory.setOption(option)
setInterval(() => {
if (option.dataZoom[0].endValue == data.length + 1) {
option.dataZoom[0].endValue = 4
option.dataZoom[0].startValue = 0
} else {
option.dataZoom[0].endValue = option.dataZoom[0].endValue + 1
option.dataZoom[0].startValue = option.dataZoom[0].startValue + 1
}
myChartCategory.setOption(option)
}, 5000)