Vue
HTML
<script src="https://cdn.bootcss.com/echarts/4.2.0-rc.2/echarts.min.js"></script>
<div id="app">
<div class="Business_ji" ref="Business_ji"></div>
</div>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
.Business_ji{
width: 50%;
height: 340px;
float: left;
}
Vue
new Vue({
el: "#app",
data: {
todos: [
{ text: "Learn JavaScript", done: false },
{ text: "Learn Vue", done: false },
{ text: "Play around in JSFiddle", done: true },
{ text: "Build something awesome", done: true }
]
},
created(){
this.$nextTick(function () {
this.resourceDatachushi(this.todos)
})
},
methods: {
toggle: function(todo){
todo.done = !todo.done
},
resourceDatachushi(el){
let _this=this
let dataT=el
let xinshuzu=[]
for(let i=0;i<dataT.length;i++){
xinshuzu.push({name:'外部商机'+(i+1),value:1024*(i+1)});
}
let myChart = echarts.init(this.$refs.Business_ji)
let option = {
//color:['#FED350', '#59CA92'],
title:{
x:"center",
y:"center",
textStyle:{
fontSize:"28px",
color:"rgb(88,88,88)",
},
},
tooltip: {
confine:true,
show:true,
trigger: 'item',
formatter: "{b}:{d}%"
},
legend: {
data:['教育事业','环保事业','赈灾扶贫','其他公益事业'],
bottom: 0,
left: 'center',
},
series: [
{
type: 'pie',
avoidLabelOverlap:true,
clockwise:false,
silent: true,
radius: ["45%","65%"],
center: ['50%', '50%'],
labelLine:{
show:true,
length2:28
},
label: {
normal: {
show: false,
},
emphasis: {
show: true,
textStyle: {
fontSize: '10',
fontWeight: 'bold'
}
}
},
itemStyle: {
normal: {
color: function (p){
if ( p.name ==...