echarts饼图的设置
饼图指示线和饼图文字改变默认字体的方法
option = {
tooltip: {
trigger: "item",
},
legend: {
orient: "vertical",
left: "75%",
top: "25%",
textStyle: {
color:'#fff',
fontSize: 15,
},
},
series: [
{
name: "访问来源",
type: "pie",
radius: ["40%", "60%"],
center: ["35%", "50%"],
data: [
{
value: 10,
name: "质量",
},
{
value: 15,
name: "态度",
},
{
value: 20,
name: "卫生",
},
{
value: 25,
name: "",
},
{
value: 30,
name: "其他",
},
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
label: {
show: true,//是否展示文字
position: "outside",
color:'#fff',//改变默认黑底白边的字体颜色
formatter: "{a|{b}:{d}%}\n{hr|}",
padding: [0, -40],//文字的位置
rich: {
a: {
padding: [-30, 15, -20, 15],
},
},
},
//饼图指示线的设置
labelLine: {
normal: {
length: 10,//指示线的长度
length2: 34,
color:'#fff'
lineStyle: {
width: 1,
},
},
},
},
],
};