Skip to content

堆叠柱状图在dataset数据源下值为0时label出现重叠,如何不显示其中某些数据的label #9438

@charon316

Description

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

General Questions

PLEASE MAKE SURE OF ALL THE FOLLOWING OPTIONS IN REQUIRED FIELDS ARE TICKED (with x)!
Otherwise, the issue will not be answered.
And think before you tick. :)
请确保以下每项都打上勾了!并且确保都做了这些事哦~ 这将大量简化我们的工作流程,使你的问题更快速得到解答。

  • Required: I have read the document and examples and tried to solve it by myself. (必填)我读过了文档和教程,并且曾试图自己解决问题。
  • Required: I have searched for similar issues and that didn't help. (必填)我搜索过 issue 但是没有帮助。
  • 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 中我提供了以下信息:

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

Issue Type

  • I have a question to ask about how to use ECharts to ...;我想提问如何使用 ECharts 实现某功能
  • 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

堆叠柱状图在使用dataset作为数据源时,当某一项的值为0时,该项的label与前一数据的label重叠的情况。能否在页面上不显示为0的label?

Expected Behavior

数据为0时,label不显示。(tooltip中依旧可以看到为0的项)

Current Behavior

堆叠柱状图在使用dataset作为数据源时,当某一项的值为0时,该项的label与前一数据的label重叠。

Online Example

THIS IS REQUIRED FOR ALL BUG REPORTS AND QUESTIONS!!! 如果是提问或报 bug 一定要提供这一项!

demo链接

有尝试在label的formmater中进行手动控制返回,但是没有生效。
formatter: function(data) {
for(let i in data.data) {
if (typeof i==='number') {
if (i>0) {
return i;
}
return '';
}
return i;
}
}

Topics

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

Anything Else We Need to Know

issue #5657 提到了类似的问题,但是没有提供解法就关闭掉了。

Environment

  • ECharts version;ECharts 版本: 4.x

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

Metadata

Metadata

Assignees

Labels

bugstaleInactive for a long time. Will be closed in 7 days.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions