饼图 图上带文字

描述:当前是关于Echarts图表中的 饼图 示例。
 
            const chartData = [
    {
      name: '重大风险',
      value: '10'
    },
    {
      name: '较大风险',
      value: '20'
    },
    {
      name: '一般风险',
      value: '30'
    },
    {
      name: '低风险',
      value: '40'
    },
    {
      name: '其他',
      value: '50'
    }
  ]
const color = ['rgba(255, 87, 139, 1)', 'rgba(255, 119, 51, 1)', 'rgba(254, 197, 102, 1)', 'rgba(38, 137, 255, 1)', 'rgba(51, 187, 255, 1)']
option = {
   legend: {
     show: false
   },
   series: [
      {
         name: '',
         type: 'pie',
         roundCap: true,
         radius: ['40%', '65%'],
         center: ['30%', '50%'],
         startAngle: 60, //起始角度
         data: chartData,
         itemStyle: {
            borderColor: '#fff',
            borderWidth: 2,
            color: function (params) {
               return color[params.dataIndex]
            },
         },
         labelLine: {
            length: 8,
            length2: 16,
            lineStyle: {
               width: 1,
            },
         },
         label: {
            show: true,
            position: 'inside',
            padding: [0, -4, 0, -4],
            formatter(params) {
               return params.value + '%'
            },
            color: '#fff',
            fontSize: '14px',
            lineHeight: 10,
         },
      },
   ],
};