|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
<template> |
|
|
|
|
<div ref="pie3d" style="width: 100%;height: 100%;position: relative;z-index:3" /> |
|
|
|
|
<div id="pie3d" style="width: 100%;height: 100%;position: relative;z-index:3" /> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import * as echarts from 'echarts'; |
|
|
|
@ -64,8 +64,17 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.myChart = echarts.init(this.$refs.pie3d); |
|
|
|
|
this.init() |
|
|
|
|
this.$nextTick(()=>{ |
|
|
|
|
this.myChart = echarts.init(document.getElementById('pie3d')); |
|
|
|
|
|
|
|
|
|
window.addEventListener('resize', ()=>{ |
|
|
|
|
// 当屏幕大小变化时,重置ECharts实例的尺寸 |
|
|
|
|
|
|
|
|
|
this.myChart.resize(); |
|
|
|
|
}); |
|
|
|
|
this.init() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//初始化构建 |
|
|
|
@ -75,6 +84,7 @@ export default { |
|
|
|
|
this.myChart.setOption(this.option); |
|
|
|
|
//鼠标移动上去 |
|
|
|
|
this.bindListen(this.myChart); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
// 监听鼠标事件,实现饼图选中效果(单选),近似实现高亮(放大)效果。 |
|
|
|
|
bindListen(myChart) { |
|
|
|
|