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

[Bug] 5.2.1版本下,环形图series下的data属性的label属性,为数据定制标签功能不生效了,在5.0.2版本还是OK的 #16282

Closed
fengnian7 opened this issue Dec 25, 2021 · 3 comments
Labels

Comments

@fengnian7
Copy link

fengnian7 commented Dec 25, 2021

Version

5.2.1

Link to Minimal Reproduction

No response

Steps to Reproduce

你好我们的使用场景是:
环形图的最外层的label,以及emphasis我设置为false,因为我们的使用场景不想要他展示,就是想实现环形图中心定制文字的场景。不需要展示label,所以我们的代码如下,举个例子:
在5.0.2版本,我这样设置环形图中心的label

option = {
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    legend: {
        orient: 'vertical',
        left: 10,
        data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
    },
    series: [
        {
           name: '访问来源',
            type: 'pie',
            radius: ['50%', '70%'],
            avoidLabelOverlap: false,
            label: {
                show: false,
                position: 'center'
            },
            emphasis: {
                label: {
                    show: false,
                    fontSize: '30',
                    fontWeight: 'bold'
                }
            },
            labelLine: {
                show: false
            },
            data: [
                {value: 335, name: '直接访问'},
                {value: 310, name: '邮件营销'},
                {value: 234, name: '联盟广告'},
                {value: 135, name: '视频广告'},
                {value: 1548, name: '搜索引擎'},
                {label: {
                         normal : {
              position: 'center',
              formatter: ['{c| }', '{b| 中心标签}', ].join('\n'),            
              show: true,
              rich: {
                b : {
                  color: '#333'
                }
              }
            }
                }}
            ]
        }
    ]
};

给中心直接label写死为“中心标签”,5.0.2版本可以生效,环形图中间的四个字正常显示
但是同样的代码,在5.2.1版本下,这个series.date.label不生效了,这四个文字无法显示了

Current Behavior

从5.0.2版本升级到5.2.1版本之后,环形图中间的文字展示不出来了

Expected Behavior

期望5.2.1版本,环形图中心的文字能够展示

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@fengnian7 fengnian7 added the bug label Dec 25, 2021
@echarts-bot echarts-bot bot added pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Dec 25, 2021
@echarts-bot
Copy link

echarts-bot bot commented Dec 25, 2021

@fengnian7 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED

TITLE

[Bug] Under version 5.2.1, the label attribute of the data attribute under the ring chart series, the function of customizing labels for data is not effective, and it is STILL OK in version 5.0.2

BODY

Version

5.2.1

Link to Minimal Reproduction

No response

Steps to Reproduce

Hello, our usage scenarios are:
The outermost label of the ring chart, and emphasis I set to false, because our use scene does not want him to display, just want to realize the scene of customized text in the center of the ring chart. There is no need to display the label, so our code is as follows, for example:
In version 5.0.2, I set the label in the center of the ring chart like this
option = {
tooltip: {
trigger:'item',
formatter:'{a}
{b}: {c} ({d}%)'
},
legend: {
orient:'vertical',
left: 10,
data: ['Direct Access','Email Marketing','Affiliate Advertising','Video Advertising','Search Engine']
},
series: [
{
name:'Access source',
type:'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position:'center'
},
emphasis: {
label: {
show: false,
fontSize: '30',
fontWeight:'bold'
}
},
labelLine: {
show: false
},
data: [
{value: 335, name:'Direct access'},
{value: 310, name:'Email marketing'},
{value: 234, name:'Affiliate Ads'},
{value: 135, name:'Video ad'},
{value: 1548, name:'Search Engine'},
{label: {
normal: {
position:'center',
formatter: ['{c| }','{b| center label}', ].join('\n'),
show: true,
rich: {
b: {
color:'#333'
}
}
}
}}
]
}
]
};
Write down the center label directly as "center label", version 5.0.2 can take effect, and the four characters in the middle of the ring graph are displayed normally
But with the same code, under version 5.2.1, this series.date.label is not valid, and these four texts cannot be displayed anymore.

Current Behavior

After upgrading from version 5.0.2 to version 5.2.1, the text in the middle of the ring chart cannot be displayed

Expected Behavior

It is expected that version 5.2.1, the text in the center of the ring chart can be displayed

Environment

-OS:
-Browser:
-Framework:

Any additional comments?

No response

@pissang
Copy link
Contributor

pissang commented Dec 29, 2021

@fengnian7 因为新版本非法数据被过滤了,你可以把最后一个数据的 value 设置为 0。如果你只是想要在这地方放一个标签,可以用 title 组件或者更灵活的 graphic 组件

@pissang pissang removed bug pending We are not sure about whether this is a bug/new feature. labels Dec 29, 2021
@fengnian7
Copy link
Author

十分感谢,其他两种方式我们之前测试过,因为我们的使用场景比较特殊,所以该方法都没有用,刚才通过加个value字段解决问题了。哈哈

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

No branches or pull requests

2 participants