You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/04/17 03:31:44 UTC

[GitHub] weiweismile opened a new issue #8173: legend.type = "scroll" 的文字不能展示完整,会被遮挡

weiweismile opened a new issue #8173: legend.type = "scroll" 的文字不能展示完整,会被遮挡
URL: https://github.com/apache/incubator-echarts/issues/8173
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   需求是一行展示两个饼图,所以使用了flex布局, 使用饼图legend.type = "scroll"时,legend的文字较长的话,文字不能展示完整,会被遮挡。发现设置legend的width并没有效果。它会自动调节宽度,使得文字继续被遮挡。(使用的是vue框架,实例是官网的实例:http://echarts.baidu.com/examples/editor.html?c=pie-legend)
   
   
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]: 4.0.4
   + Browser version [浏览器类型和版本]: chorme 版本 65.0.3325.181(正式版本) (64 位)
   + OS Version [操作系统类型和版本]: macOS Sierra 10.12
   + 实际结果:
   名字没有展示完整
   ![image](https://user-images.githubusercontent.com/24568916/38847152-bacf10ac-4232-11e8-80be-0007e20248a4.png)
   
   
   
   
   ### Expected behaviour [期望结果]
   
   展示完整的名字
   
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   option = {
           title: {
             text: '同名数量统计',
             subtext: '纯属虚构',
             x: 'center',
           },
           tooltip: {
             trigger: 'item',
             formatter: '{a} <br/>{b} : {c} ({d}%)',
           },
           legend: {
             type: 'scroll',
             orient: 'vertical',
             right: 10,
             top: 20,
             bottom: 20,
             data: this.data.legendData,
             // selected: this.data.selected,
           },
           series: [
             {
               name: '姓名',
               type: 'pie',
               radius: '55%',
               center: ['40%', '50%'],
               data: this.data.seriesData,
               itemStyle: {
                 emphasis: {
                   shadowBlur: 10,
                   shadowOffsetX: 0,
                   shadowColor: 'rgba(0, 0, 0, 0.5)',
                 },
               },
             },
           ],
         }
   
   
   
   其他函数:
   function genData() {
         const legendData = [];
         const seriesData = [];
         const selected = {};
         for (let i = 0; i < 50; i++) {
           let name = Math.random() > 0.65
               ? this.makeWord(4, 1) + '·' + this.makeWord(3, 0)
               : this.makeWord(2, 1);
           name += '';
           legendData.push(name);
           seriesData.push({
             name,
             value: Math.round(Math.random() * 100000),
           });
           selected[name] = i < 6;
         }
         return {
           legendData,
           seriesData,
           selected,
         };
       },
       function makeWord(max, min) {
         const nameList = [
           '赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', '陈', '褚', '卫', '蒋',
           '沈', '韩', '杨', '朱', '秦', '尤', '许', '何', '吕', '施', '张', '孔', '曹',
           '严', '华', '金', '魏', '陶', '姜', '戚', '谢', '邹', '喻', '柏', '水', '窦',
           '章', '云', '苏', '潘', '葛', '奚', '范', '彭', '郎', '鲁', '韦', '昌', '马', '苗', '凤',
           '花', '方', '俞', '任', '袁', '柳', '酆', '鲍', '史', '唐', '费', '廉', '岑', '薛', '雷',
           '贺', '倪', '汤', '滕', '殷', '罗', '毕', '郝', '邬', '安', '常', '乐', '于', '时', '傅',
           '皮', '卞', '齐', '康', '伍', '余', '元', '卜', '顾', '孟', '平', '黄', '和', '穆', '萧', '尹',
           '姚', '邵', '湛', '汪', '祁', '毛', '禹', '狄', '米', '贝', '明', '臧', '计', '伏',
           '成', '戴', '谈', '宋', '茅', '庞', '熊', '纪', '舒', '屈',
           '项', '祝', '董', '梁', '杜', '阮', '蓝', '闵', '席', '季', '麻', '强', '贾', '路', '娄', '危',
         ];
         const nameLen = Math.ceil(Math.random() * max + min);
         const name = [];
         for (let i = 0; i < nameLen; i++) {
           name.push(nameList[Math.round(Math.random() * nameList.length - 1)]);
         }
         return name.join('');
       },
     },
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

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