Incubator-echarts: 饼状图(pie)series里设置startAngle和endAngle无法绘制出半圆环图

Created on 27 Dec 2018  ·  5Comments  ·  Source: apache/incubator-echarts

  • [x] I am using English in this issue. 在这个 Issue 中我使用了英文(强烈建议)。

General Questions

  • [x] Required: I have read the document and examples and tried to solve it by myself. (必填)我读过了文档和教程,并且曾试图自己解决问题。
  • [x] Required: I have searched for similar issues and that didn't help. (必填)我搜索过 issue 但是没有帮助。
  • [x] Required: I have tried with the latest version of ECharts and still have this problem. (必填)我试过最新版本的 ECharts,还是存在这个问题。

In this issue, I have provided information with: 在这个 issue 中我提供了以下信息:

  • [x] Required: issue type;(必填)issue 类型
  • [x] Required: one sentence description in issue details;(必填)一句话的问题描述
  • [x] Required: demo;(必填)能反映问题的例子(如果你想提问或报 bug)
  • [x] Required: ECharts version;ECharts 版本

Issue Type

  • [x] I have a question to ask about how to use ECharts to ...;我想提问如何使用 ECharts 实现某功能
  • [x] I have a bug to report;我想要报 bug
  • [ ] I have a feature to request, e.g.: I'd like a new feature that ...;我需要一个新功能
  • [ ] I have a feature to enhance, e.g.: The current feature should be improved in the way that ...;我希望改进某个功能
  • [ ] There's something wrong with the documents;文档有些问题
  • [ ] Others, or I'm not sure which issue types to choose here;其他,或我不知道应该选什么类型

Issue Details


在echart 4.0版本中,series type 为pie 时,使用startAngle和endAngle设置起始刻度无效,

Expected Behavior


使用pie绘制出半圆环形图

Current Behavior


配置项无效果

Online Example


option = {
    tooltip: {
        trigger: 'item',
        formatter: "{a} <br/>{b}: {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        x: 'left',
        data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
    },
    series: [
        {
            name:'访问来源',
            type:'pie',
            radius: ['50%', '70%'],
            startAngle:0,
            endAngle:180,
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: true,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data:[
                {value:335, name:'直接访问'},
                {value:310, name:'邮件营销'},
                {value:234, name:'联盟广告'},
                {value:135, name:'视频广告'},
                {value:1548, name:'搜索引擎'}
            ]
        }
    ]
};

Topics

  • [ ] Legend
  • [ ] Tooltip
  • [ ] Event
  • [ ] Performance
  • [ ] SVG
  • [ ] Map
  • [ ] ECharts GL
  • [ ] Third-party libraries, e.g.: Vue.js, React

Anything Else We Need to Know

Environment

echart 4.2

  • ECharts version;ECharts 版本: {DESCRIBE_HERE}
  • [ ] It happens only on certain browsers or operating systems. 对于特定浏览器或操作系统才会出现的问题,请提供相应环境信息:{BROWSER_VERSION_OR_OS_INFORMATION_HERE}
new-feature

Most helpful comment

@JohnsonWQ

Support tooltip:

option = {
    tooltip: {
        formatter: function (params) {
            if (params && params.name === 'empty') {
                return;
            }
            return ''
                + echarts.format.getTooltipMarker(params.color) 
                + params.name + ': ' + params.value 
                + ' (' + params.percent + '%)';
        }
    },
    series : [
        {
            type: 'pie',
            radius : '55%',
            data:[
                {value:335, name:'AA'},
                {value:310, name:'BB'},
                {value:234, name:'CC'},
                {value:135, name:'DD'},
                {value:1548, name:'empty', silent: true, itemStyle: {color: 'rgba(0,0,0,0)'}}
            ]
        }
    ]
};

All 5 comments

endAngle is not supported in pie chart yet.

endAngle is not supported in pie chart yet.

thanks for reply,and can i know how to draw a half-circle ring? just use 'startAngle' in the 'pie' or ??

A tricky way:

option = {
    series : [
        {
            type: 'pie',
            radius : '55%',
            data:[
                {value:335, name:'AA'},
                {value:310, name:'BB'},
                {value:234, name:'CC'},
                {value:135, name:'DD'},
                {value:1548, name:'empty', silent: true, itemStyle: {color: 'rgba(0,0,0,0)'}}
            ]
        }
    ]
};

A tricky way:

option = {
    series : [
        {
            type: 'pie',
            radius : '55%',
            data:[
                {value:335, name:'AA'},
                {value:310, name:'BB'},
                {value:234, name:'CC'},
                {value:135, name:'DD'},
                {value:1548, name:'empty', silent: true, itemStyle: {color: 'rgba(0,0,0,0)'}}
            ]
        }
    ]
};

not bad, but still has a question,can't use 'tooltip' in 'option'.if i do, the 'empty' tooltip will be show when i hover it。anyway,thank you for reply

@JohnsonWQ

Support tooltip:

option = {
    tooltip: {
        formatter: function (params) {
            if (params && params.name === 'empty') {
                return;
            }
            return ''
                + echarts.format.getTooltipMarker(params.color) 
                + params.name + ': ' + params.value 
                + ' (' + params.percent + '%)';
        }
    },
    series : [
        {
            type: 'pie',
            radius : '55%',
            data:[
                {value:335, name:'AA'},
                {value:310, name:'BB'},
                {value:234, name:'CC'},
                {value:135, name:'DD'},
                {value:1548, name:'empty', silent: true, itemStyle: {color: 'rgba(0,0,0,0)'}}
            ]
        }
    ]
};
Was this page helpful?
0 / 5 - 0 ratings

Related issues

akvaliya picture akvaliya  ·  3Comments

hanhui picture hanhui  ·  3Comments

jarben picture jarben  ·  3Comments

publisherfk picture publisherfk  ·  3Comments

kirazxyun picture kirazxyun  ·  3Comments