Commit 3a5ae479 by 王志慧

commit

1 parent 6d2305ce
...@@ -224,6 +224,7 @@ export default { ...@@ -224,6 +224,7 @@ export default {
this.isEmpty = false this.isEmpty = false
this.$nextTick(() => { this.$nextTick(() => {
this.canvas = echarts.init(this.$refs.canvas) this.canvas = echarts.init(this.$refs.canvas)
this.lineData = data.dataList
this.draw(data.dataList, queryType) this.draw(data.dataList, queryType)
}) })
} }
...@@ -233,11 +234,11 @@ export default { ...@@ -233,11 +234,11 @@ export default {
this.flag = true this.flag = true
}) })
}, },
chartAction(dataList) { chartAction() {
this.canvas.dispatchAction({ this.canvas.dispatchAction({
type: 'showTip', type: 'showTip',
seriesIndex: 0, seriesIndex: 0,
dataIndex: dataList.length - 1 dataIndex: this.lineData.length - 1
}) })
}, },
draw (lineData, queryType) { draw (lineData, queryType) {
...@@ -343,10 +344,14 @@ export default { ...@@ -343,10 +344,14 @@ export default {
] ]
} }
this.canvas.setOption(options) this.canvas.setOption(options)
this.chartAction(lineData) this.chartAction()
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.canvas.resize() this.canvas.resize()
}) })
// 移除图表
this.canvas.on('globalout', () => {
this.chartAction()
})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!