Echarts pie configuration, the intermediate graphics, text, graphics and down next to the text display

1, FIG. 1 Effect

 

<div style="height:500px;">
<div id="ec2" style="height: 98%;padding: 15px;"></div>
</div>
<script>
var dom2 = document.getElementById("ec2");
var myChart2 = echarts.init(dom2);
option2 = null;
option2 = {
tooltip: {
trigger: 'item',
formatter: " {b}:{c} "
},
color:['#D06052','#E29F39','#4C9BC7'], //环形颜色
graphic:{ //图形中间文字
type:"text",
left:"center",
top:"center",
style:{
text:"66",
textAlign:"center",
fill:"#fff",
the fontSize: 60
}
},
Series: [
{
name: '',
type: 'PIE',
RADIUS: ['30% ', '50%'], // pie size
labelLine: {// graphics to text line
normal : {
length: 35,
length2: 80
}
},
label: {
Normal: {
Formatter: 'C {|} C {%} \ {n-B | B} {}', // vertical display graphics to text
borderWidth: 20 ,
borderRadius: 4,
padding: [0, -70], and the margin of the text //
Rich: {
A: {
Color: '# 333',
fontSize: 16,
the lineHeight: 30
},
B: {// name text style
fontSize: 16 ,
the lineHeight: 30,
Color: '# CDCDD0',
},
C: {// text style value
fontSize: 16,
lineHeight: 30,
color: '#63BF6A',
align:"center"
}
}
}
},
data: [
{value: 5, name: '数据1'},
{value: 9, name: '数据2'},
{value: 16, name: '数据3'}
]
}
]
};
if (option2 && typeof option2 === "object") {
myChart2.setOption(option2, true);
}
</script>

 

Guess you like

Origin www.cnblogs.com/mlch/p/11613453.html