鍍金池/ 問答/Java  HTML/ echarts 圖例 怎么實(shí)現(xiàn)一樣的寬度

echarts 圖例 怎么實(shí)現(xiàn)一樣的寬度

如圖,需要上下對(duì)齊,想把每個(gè)圖例設(shè)置一樣寬,但是文檔里找不到這項(xiàng)配置。

clipboard.png

回答
編輯回答
無(wú)標(biāo)題

最新更新:

找到解決辦法,用富文本方式可以指定寬度:

legend: {
                   orient: 'horizontal',
                   itemWidth: 14,
                   itemHeight: 14,
                   left: 13,
                   bottom: 35,
                   icon: 'circle',
                   formatter:'{a|{name}}',
                   textStyle: {
                        rich:{
                            a: {
                                color: '#ddd',
                                fontSize: 15,
                                width: 95,
                                height: 21,
                                padding: [0,0,0,1]
                            },
                        }
                   },
                }



------------------------------------------------------------------------

之前的答案:
找到一個(gè)方法,但是有點(diǎn)不智能,暫時(shí)解決了問題。

legend可以分開設(shè)置:改變定位值就可以了。

legend: [
            {  
                orient: 'horizontal',  
                left: 13,
                bottom: 68,  
                data: ['20M以下'] 
            },
            {  
                orient: 'horizontal',  
                left: 141,
                bottom: 68,  
                data: ['20M-49M'] 
            },
            ...
        ]

在官方文檔里發(fā)現(xiàn)了這個(gè),說起來應(yīng)該可以解決問題,但是不知道為什么不生效,有時(shí)間的朋友可以研究下:http://echarts.baidu.com/opti...

clipboard.png

2018年6月9日 00:06