echarts 移入饼图提醒设置

83 阅读1分钟

  const option2: ECOption = {
        tooltip: {
            trigger: 'item'
        },
        legend: false,
        series: [
            {
                name: '饼图图',
                type: 'pie',
                radius: '60',
                data: delayOverdue,
                startAngle: endAngle,
                label: {
                    show: true,
                    position: 'middle',
                    formatter: function(params) {
                      // 利用富文本标签来设置自定义样式和换行
                      return `{b|${params.name}}\n{a|${params.value}\n占比:${params.percent}%}`;
                    },
                    rich: {
                      a: {
                        fontSize: 12, // 自定义字号和样式
                        lineHeight: 20   // 自定义行高
                      },
                      b: {
                        fontSize: 14,
                        lineHeight: 20,
                        fontWeight: 'bold'
                      }
                    }
                },
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };