饼状图
改变颜色
data: [
{
value: 335,
name: "生态补助",
itemStyle: {
normal: {
color: "#ECD220",
},
},
},
{ value: 310, name: "迁葬补助" },
{ value: 234, name: "惠民补助" },
],
饼图旋转
便于指示线的显示完整
series: [
{
name: "测试饼图",
startAngle: 160, //起始角度
type: "pie",
},
],
避免标签重叠
series: [
{
name: "测试饼图",
type: "pie",
startAngle: 90, //起始角度
radius: ["35%", "50%"],
//避免标签重叠
avoidLabelOverlap: true,
},
],
饼图中间显示文字
option:{
graphic: {
type: "text",
left: "center",
top: "center",
style: {
text: "火化量\n" + "100", //使用“+”可以使每行文字居中
textAlign: "center",
fill: "#fff",
width: 30,
height: 30,
},
}, //此例饼状图为圆环中心文字显示属性,这是一个原生图形元素组件,功能很多
}
https://blog.csdn.net/zhengshaofeng1/article/details/106358494
柱状图
柱形图柱子自定义颜色
series: [
{
name: "测试柱形图",
type: "bar",
itemStyle: {
normal: {
color: function (params) {
var colorList = ["#F08217", "#D417F0", "#ECD220"];
return colorList[params.dataIndex];
},
barBorderRadius: [0, 18, 18, 0],
},
},
barWidth: "20", //---柱形宽度
// barCategoryGap: "20%", //---柱形间距
data: [222, 478, 784],
label: {
show: true,
position: "insideTop",
},
}
],