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