apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.71k stars 19.62k forks source link

[Bug] 饼图,不能在没有任何提示的情况下直接筛选去除我数据中存在的负值,这会导致我想要的结果不完整 #20473

Closed lascyb closed 2 weeks ago

lascyb commented 2 weeks ago

Version

5.5.1

Link to Minimal Reproduction

https://codesandbox.io/p/devbox/kz4yvk

Steps to Reproduce

所有的值只要是负数就会存在

Current Behavior

我司财务报表中中存在部分负利润,但是在饼图展示时直接被隐藏,这是无法接受的结果

Expected Behavior

它可以报错,也可以令图表直接不显示,我可以人工处理含负值的数据,但是不能在没有任何提示的情况下直接筛选去除我数据中存在的负值

Environment

- OS: Windows 10
- Browser: Microsoft Edge 130.0.2849.68
- Framework: Vue@3.4.15

Any additional comments?

No response

echarts-bot[bot] commented 2 weeks ago

@lascyb 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] pie chart, I can't filter directly to remove the negative values present in my data without any prompt, which will result in incomplete results that I want **BODY** ### Version 5.5.1 ### Link to Minimal Reproduction https://codesandbox.io/p/devbox/kz4yvk ### Steps to Reproduce All values ​​exist as long as they are negative ### Current Behavior There are some negative profits in our company's financial statements, but they are directly hidden when the pie chart is displayed. This is an unacceptable result. ### Expected Behavior It can report an error or prevent the chart from being displayed. I can manually process data containing negative values, but I cannot directly filter out the negative values ​​in my data without any prompts. ### Environment ```markdown - OS: Windows 10 - Browser: Microsoft Edge 130.0.2849.68 - Framework: Vue@3.4.15 ``` ### Any additional comments? _No response_
lascyb commented 2 weeks ago

我在 #15095 中,看到了一些这方面的更改,但是标题写的是 - 令饼图支持负值,结果却是直接筛选去除了负值

helgasoft commented 2 weeks ago

Official API does not mention negative values, so this is not-a-bug. Workaround to show negative-value sectors - add absolute values as another data column - Demo. image

📌 please close issue if problem solved.

lascyb commented 2 weeks ago

你好 @helgasoft ,感谢回复

不知道我描述的您是否可以理解 (ps.其实就是,不支持负值就直接报错吧,不要动用户的数据T_T)

Ovilia commented 2 weeks ago

@lascyb Negative values are not expected in Pie charts because it's meaningless to have negative pie pieces so it's natural to be filtered. If not, the total value could be not as expected. ECharts filters invalid data so that the rest can be displayed. There is no reason to print an error log and renders nothing when there is a negative value. You should be responsible for your input to make sure it's valid all the time. Otherwise, there is possibility that you get expected result with valid input before your presentation and then when in presentation, the data dynamically changed and have negative ones.

lascyb commented 2 weeks ago

@Ovilia 文档中没有任何地方提示过负值会被过滤,这种没有任何提示且不经过用户设置就直接过滤用户数据进行渲染的行为我觉得很无语

lascyb commented 2 weeks ago

或许含有负数的饼图毫无意义,但是总有些数据会含有负数,这个控制权应该交给用户,而不是让觉得负数无意义就把它自行删除

lascyb commented 2 weeks ago

有没有个什么东西可以发起个投票

Ovilia commented 2 weeks ago

As I explained, this is the universal behavior of ECharts. If you feel otherwise, you may make a pull request and let's discuss about it later.