【echarts 饼图引导线末端新增圆点】

echarts 饼图引导线末端新增圆点

需求

在这里插入图片描述

代码

let bgColor = "#000000";
let title = "总量";
let color = ["#EBC85E", "#4DAF7B", "#E15331", "#F8456B", "#00FFFF", "#4AEAB0"];
let data = [
  {
    stationName: null,
    count: 1,
    studyClass1: "12",
    percent: "0.00",
  },
  {
    stationName: null,
    count: 1,
    studyClass1: "ECG",
    percent: "0.00",
  },
  {
    stationName: null,
    count: 1,
    studyClass1: "MR",
    percent: "0.00",
  },
  {
    stationName: null,
    count: 1,
    studyClass1: "NM",
    percent: "0.00",
  },
];
let echartData = data.map((val) => {
  return {
    name: val.studyClass1,
    value: val.count,
  };
});
let echartData1 = echartData.map((val, index) => {
  return {
    ...val,
    label: {
      textStyle: {
        color: color[index % 6],
      },
    },
  };
});
option = {
  backgroundColor: bgColor,
  color: color,
  title: [
    {
      left: "center",
      text: "日诊断量分布",
      top: "0%",
      textStyle: {
        fontSize: 22,
        color: "#ffffff",
        fontWeight: 500,
      },
    },
  ],
  series: [
    {
      itemStyle: {
        normal: {
          label: {
            show: true,
            textStyle: {
              color: color,
            },
          },
          borderWidth: 4,
          borderColor: "#000000",
        },
      },
      type: "pie",
      radius: ["30%", "60%"],
      center: ["50%", "50%"],
      data: echartData1,
      hoverAnimation: false,
      labelLine: {
        normal: {
          length: 40,
          length2: 130,
          lineStyle: {
            color: "#e6e6e6",
          },
        },
      },
      label: {
        normal: {
          alignTo: "labelLine",
          // ·圆点
          backgroundColor: "auto",
          height: 0,
          width: 0,
          lineHeight: 0,
          distanceToLabelLine: 0,
          borderRadius: 5,
          padding: [5, -5, 5, -5],
          formatter: (params) => {
            return `{name|${params.name}${params.percent}%}`;
          },
          rich: {
            name: {
              fontSize: 18,
              padding: [0, -110, 20, -110],
              fontWeight: "bold",
            },
          },
        },
      },
    }
  ],
};

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值