linxianseng commented on issue #13208:
URL:
https://github.com/apache/incubator-echarts/issues/13208#issuecomment-683525463
<template>
<div >
<div style="overflow-y:auto;background-color:green;height:500px"
id="mybox" >
<el-row style="overflow-y:auto;background-color:yellow">
<el-col :span="20" >
<div id="myChart" :style="{height:aaa+'px'}"></div>
</el-col>
<el-col :span="4">
<div v-for="item in arr" :key="item" ref="my">
<div style="height:50px">{{item}}</div>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
arr:[],
num:0,
mixarr:[],
total:0 ,
aaa:100,
},
methods: {
fix(){
this.$nextTick(function() {
let div = document.getElementById('mybox');
div.scrollTop = div.scrollHeight;
})
},
add(){
setTimeout(()=>{
this.num ++;
this.arr.push(this.num)
},500)
},
addmix(){
for(let a=0;a<5;a++){
this.mixarr.unshift(Math.ceil(Math.random()*10))
}
},
initEcharts(){
let myChart = this.$echarts.init(document.getElementById('myChart'))
myChart.resize({height:this.total});
let option = {
xAxis: {
show:false,
type: 'value',
},
yAxis: {
show:false,
type: 'category'
},
series: [
{
data: this.mixarr,
type: 'line',
smooth: true
}
]
};
myChart.setOption(option)
}
},
mounted(){
this.$nextTick(() => {
this.initEcharts();
})
this.add()
},
updated(){
this.$nextTick(() => {
this.initEcharts();
this.fix()
})
this.add();
this.addmix();
this.total=this.$refs.my.length*50
},
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]