echarts 饼图中间文字颜色大小设置

想要实现的效果如下:
在这里插入图片描述
只要在formatter里这样写就可以啦,rich里面写你需要的样式即可

  var option = {
            color: ['#3d6dfe', '#27b3ff', '#2fffc1', '#ff892f', '#fcff2f'],
            tooltip: {
                trigger: 'item'
            },
            legend: {
                type: 'scroll',
                itemWidth: 12,
                itemHeight: 10,
                itemGap: 25, // 修改间距
                textStyle: {
                    color: '#E0E0E0',
                },
                orient: 'vertical',
                x:'right',      // 图例在左(left)、右(right)、居中(center)、100px
                y:'center',      // 图例在上(top)、下(bottom)、居中(center、100px)、100px
                padding:[0,50,0,0],   // 图例[距上右下左方距离
            },
            series: [
                {
                    name: '专利类型',
                    type: 'pie',
                    radius: ['40%', '70%'],
                    center: ['40%', '50%'],
                    avoidLabelOverlap: false,
                    padAngle: 2,
                    itemStyle: {
                        borderRadius: 5
                    },
                    label: {
                        show: false,
                        position: 'center',
                    },
                    emphasis: {
                        label: {
                            show: true,//中间文字显示
                            fontSize: 16,
                            formatter(params) {
                            	return '{total|' + params.value +'}'+ '\n\r' + '{active|'+ params.name +'}'
                            },
                            rich: {
                                total:{
                                    fontSize: 25,
                                    fontWeight: 'bold',
                                    color:'#fff'
                                },
                                active: {
                                    fontSize: 14,
                                    color:'#fff',
                                    lineHeight:30,
                                },
                            }
                        }
                    },
                    data: data
                }
            ]
        };
        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值