echarts 给formatter文字添加不同颜色


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
                    }
                },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM