You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/03/22 06:23:06 UTC

[GitHub] [echarts] 100pah commented on issue #14508: v5.0.2 legend.textStyle.rich.{className}.width can't work

100pah commented on issue #14508:
URL: https://github.com/apache/echarts/issues/14508#issuecomment-803795554


   @zhangjianrencai 
   The width of that text block has been 100.
   Please check this:
   ```js
   option = {
       title: {
           text: '某站点用户访问来源',
           subtext: '纯属虚构',
           left: 'center'
       },
       tooltip: {
           trigger: 'item'
       },
       legend: {
           orient: 'horizontal',
           width: '200',
           left: 'left',
           textStyle: {
             fontSize: 14,
             color: '#5A6872',
             rich: {
               a: {
                 width: 100,
                 backgroundColor: 'red', // show the text block
                 align: 'center'                  // might be what you need?
               }
             }
           },
           formatter: function (name) {
             return '{a|' +  name+  '}';
           },
       },
       series: [
           {
               name: '访问来源',
               type: 'pie',
               radius: '50%',
               data: [
                   {value: 1048, name: '搜索引擎'},
                   {value: 735, name: '直接访问'},
                   {value: 580, name: '邮件营销'},
                   {value: 484, name: '联盟广告'},
                   {value: 300, name: '视频广告'}
               ],
               emphasis: {
                   itemStyle: {
                       shadowBlur: 10,
                       shadowOffsetX: 0,
                       shadowColor: 'rgba(0, 0, 0, 0.5)'
                   }
               }
           }
       ]
   };
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org