玫瑰图自定义标题和图例

描述:当前是关于Echarts图表中的 示例。
 
            let datas = [
   {
      name: '数据1',
      value: 1,
   },
   {
      name: '数据2',
      value: 3,
   },
   {
      name: '数据3',
      value: 4,
   },
   {
      name: '数据4',
      value: 5,
   },

]
option = {
   color: [
      '#FFC00C',
      '#34C759',
      '#14A5FF',
      '#007AFF',
      '#F56463',
      '#00C6FF',
      '#F09615',
      '#0079E6',
      '#a814ff',
   ],
   title: {
      text: '数据标题',
      x: 'center',
      y: 310,
      textStyle: {
         color: '#040404',
         fontSize: 18,
         fontWeight: 500,
      },
      subtext: '内容说明',
      subtextStyle: {
         color: '#A0AFC4',
         fontSize: 12,
      },
   },
   legend: [
      {
         data: ['数据1', '数据2'],
         icon: 'circle',
         x: 'center',
         y: 390,
         formatter: function (name) {
            let value = 0
            for (let i = 0; i < datas.length; i++) {
               if (datas[i].name == name) {
                  value = datas[i].value ? datas[i].value * 100 : 0
               }
            }
            return `{b_style|${name}} {c_style|${value}}`
         },
         textStyle: {
            color: '#000',
            rich: {
               b_style: {
                  color: '#A0AFC4',
                  fontSize: 12,
                  padding: [0, 5, 0, 0],
               },
               c_style: {
                  color: '#007AFF',
                  fontSize: 14,
               },
            },
         },
      },
      {
         data: ['数据3', '数据4'],
         icon: 'circle',
         x: 'center',
         y: 415,
         formatter: function (name) {
            let value = 0
            for (let i = 0; i < datas.length; i++) {
               if (datas[i].name == name) {
                  value = datas[i].value ? datas[i].value * 100 : 0
               }
            }
            return `{b_style|${name}} {c_style|${value}}`
         },
         textStyle: {
            color: '#000',
            rich: {
               b_style: {
                  color: '#A0AFC4',
                  fontSize: 12,
                  padding: [0, 5, 0, 0],
               },
               c_style: {
                  color: '#007AFF',
                  fontSize: 14,
               },
            },
         },
      },
   ],
   tooltip: {
      show: false,
      textStyle: {
         color: '#ffffff',
      },
      borderColor: 'transparent',
      backgroundColor: 'rgba(0, 122, 255, 0.8)',
      extraCssText: 'backdrop-filter: blur(6px);',
   },
   series: [
      {
         name: '',
         type: 'pie',
         radius: [32, 91],
         center: ['50%', '34%'],
         roseType: 'radius',
         label: {
            show: false,
            position: 'center',
            formatter: '{c_style|{c}%}', //'{b_style|{b}}\n{c_style|{c}%}\n{b_style|{d}%}',
            rich: {
               c_style: {
                  color: '#007AFF',
                  fontSize: 18,
                  fontWeight: 600,
               },
            },
         },
         emphasis: {
            label: {
               show: true,
               fontSize: '14',
               fontWeight: 'normal',
            },
         },
         labelLine: {
            show: false,
         },
         data: datas,
      },
   ],
};