我是靠谱客的博主 无聊心情,这篇文章主要介绍echarts的dispatchAction操作: 默认选中最右一项tooltip, dataZoom可视区域默认置于最左,现在分享给大家,希望可以做个参考。

	drawChart(){
let xData=[] // x轴数据
let showCount = 4 // 可视区域内展示数量
let mychart= this.$echarts.init(document.getElementById('chartId'))
mychart.clear()
mychart.setOption(options)
mychart.clear()
// 默认选中最右一项弹出tooltip
mychart.dispatchAction({
type: 'showTip',
position: [220, 180], // 调整位置
seriesIndex: 0, // 系列的 index
dataIndex: xData.length - 1 // 数据的 index
})
// dataZoom可视区域默认置于最左
mychart.dispatchAction({
type: 'dataZoom',
startValue: 0,
endValue: xData.length > 1 ? showCount - 1 : 0 // showCount为可视区域内展示数量
})
}

最后

以上就是无聊心情最近收集整理的关于echarts的dispatchAction操作: 默认选中最右一项tooltip, dataZoom可视区域默认置于最左的全部内容,更多相关echarts的dispatchAction操作:内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(133)

评论列表共有 0 条评论

立即
投稿
返回
顶部