Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

饼图数据项过多时,指示线超出绘图区域 #8390

Closed
cxytomo opened this issue May 24, 2018 · 5 comments
Closed

饼图数据项过多时,指示线超出绘图区域 #8390

cxytomo opened this issue May 24, 2018 · 5 comments
Assignees

Comments

@cxytomo
Copy link

cxytomo commented May 24, 2018

One-line summary [问题简述]

饼图数据项过多时,指示线超出绘图区域

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:3.8.4
  • Browser version [浏览器类型和版本]:都存在
  • OS Version [操作系统类型和版本]:都存在

Expected behaviour [期望结果]

指示线全部包含在绘图区域内

ECharts option [ECharts配置项]

option = {
            tooltip: {
                trigger: 'item',
                //访问来源
                //ip:数量(百分比)
                backgroundColor: 'rgba(15, 25, 53, 0.8)',
                borderColor: 'rgba(15, 25, 53, 0.8)',
                formatter: function(params) {
                    var _html = '';
                    _html += '<div class="tooltip-wrapper controller-1"><h3 class="tooltip-title">' + params.name + '</h3>';
                    _html += '<div class="tooltip-cont">防护次数占比:' + params.percent + '%</div>';
                    _html += '<div class="tooltip-cont">防护次数:' + thousandBitSeparator(params.value) + '次</div>';
                    _html += '</div>';
                    return _html;
                }
            },
            color: ['#BB312B','#FF7336','#B5DE56','#E7A541','#ABD2FA','#9489E0','#30AEF0','#1676A8','#4598E3','#53E0EA'],
            legend: {
                show: false
            },
            grid: {
                top: '4%',
                bottom: '0',
                containLabel: true
            },
            series: [{
                name: '',
                type: 'pie',
                center : [ '50%', '180' ],
                //startAngle: 0,
                labelLine: {
                    normal: {
                        length: 0,
                        length2: 20,
                        lineStyle: {
                            color: '#fff'
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        opacity: 0.8
                    },
                    emphasis: {
                        opacity: 1
                    }
                },
                label: {
                    normal: {
                        color: '#fff'
                    }
                },
                data: [{
        "percent": "86.49%",
        "name": "业务音乐",
        "value": 65
    }, {
        "name": "业务数媒",
        "percent": "81.08%",
        "value": 40
    }, {
        "percent": "13.51%",
        "name": "业务动漫",
        "value": 4
    }, {
        "name": "业务视讯",
        "percent": "0.00%",
        "value": 1
    }, {
        "value": 2,
        "name": "**院",
        "percent": "0.00%"
    }, {
        "value": 0.5,
        "name": "验收测试",
        "percent": "0.00%"
    }, {
        "name": "验收测试2",
        "percent": "0.00%",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "业务互娱",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "name": "业务视讯",
        "percent": "0.00%",
        "value": 0
    }, {
        "value": 0,
        "name": "杭研院",
        "percent": "0.00%"
    }, {
        "value": 0,
        "name": "验收测试",
        "percent": "0.00%"
    }, {
        "name": "验收测试2",
        "percent": "0.00%",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "业务互娱",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }, {
        "percent": "0.00%",
        "name": "互联网业务基地",
        "value": 0
    }]
            }]
        };

Other comments [其他信息]

##示例截图
default

@cxytomo
Copy link
Author

cxytomo commented May 24, 2018

数据项数量不定,有多有少,分布也没有规律

@hanfengcan
Copy link

想这种情况,不是要合并那些小数据项成其他会合适一点?

@cxytomo
Copy link
Author

cxytomo commented Jun 11, 2018

@hanfengcan 但是需求方想看到所有业务

@airwin
Copy link

airwin commented Jun 11, 2018

我们也遇到了类似的问题,应该是饼图的avoidLabelOverlap防标签冲突机制,导致的渲染超出容器,目前还没有好的方案,临时调整一下startAngle来规避,期望官网的解决方案

@airwin
Copy link

airwin commented Jun 13, 2018

@cxytomo 我提了一个PR,暂时能够规避标签渲染出范围,可以参考 #8513

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants