注意使用箭头函数,否则无法改变data里值
drawPie() {
const echarts = require('echarts');
let myChart = echarts.init(document.getElementById('chartpie'));
myChart.setOption({
color:['#039be5','#ff00ff','#6baf47','#f3c654','#80dfb6'],
tooltip: {
trigger: 'item',
formatter: '{b}: ({d}%)',
},
series: [
{
name: 'Access source',
type: 'pie',
radius: ['50%', '95%'],
avoidLabelOverlap: false,
label: {
show:true,
position:'inner',
formatter:'{d}%'
},
emphasis: {
label: {
show: true,
fontSize: '12',
color:'#fff'
}
},
labelLine: {
show: true
},
data: [
{value: 43, name:'Strategic investors'},
{value: 12, name:'Launch PAD sale'},
{value: 16, name: 'Foundation ECO reward pool'},
{value: 10, name: 'Treasury'},
{value: 6, name: 'Founders and team'},
],
}
]
});
myChart.on('mouseover',(params) => {
this.titCur = params.data.name
})
}