echarts 给formatter文字添加不同颜色

echarts 给formatter文字添加不同颜色,第1张

 

legend: {
                    x : 'center',
                    y : 'bottom',
                    icon: "circle",
                    itemWidth: 8,  // 设置宽度
                    itemHeight: 8, // 设置高度
                    itemGap: 20,// 设置间距
                    orient: 'vertical',
                    top:'80%',
                    data:this.labels,
                    formatter: function(value) {
                            if (value.length > 4) {
                            return  value.substring(0, 4) + "..." + '{a|'+ '|  20%' +'}' + '20';
                            } else {
                            return value + '{a|'+ '|  20%' +'}' + '20';
                            }
                    },
                    textStyle:{
                        fontSize:15,
                        //在rich中给formatter添加个别字体颜色
                        rich:{
                            a:{
                                color:'#03a9f4',
                                padding:[0,10],
                                fontSize:15
                            },
                        },
                    },
                    tooltip: {
                        show: true
                    }
                },

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1298989.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存