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] dataset 同名数据重叠,且tooltip formatter 字符串模板无法访问数据集数据 #19917

Open
Corps-Yan opened this issue May 10, 2024 · 6 comments
Labels
bug pending We are not sure about whether this is a bug/new feature.

Comments

@Corps-Yan
Copy link

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html

Steps to Reproduce

image

Current Behavior

option = {
legend: {},
tooltip: {
formatter: '@{product} @{2015} {c0}'
},
dataset: {
// 提供一份数据。
source: [
['product', '2015', '2016', '2017'],
['Matcha Latte', 43.3, 85.8, 93.7],
['Milk Tea', 83.1, 73.4, 55.1],
['Milk Tea', 83.1, 73.4, 55.1],
['Cheese Cocoa', 86.4, 65.2, 82.5],
['Walnut Brownie', 72.4, 53.9, 39.1]
]
},
// 声明一个 X 轴,类目轴(category)。默认情况下,类目轴对应到 dataset 第一列。
xAxis: { type: 'category' },
// 声明一个 Y 轴,数值轴。
yAxis: {},
// 声明多个 bar 系列,默认情况下,每个系列会自动对应到 dataset 的每一列。
series: [{ type: 'bar' }]
};

Expected Behavior

  1. tooltip字符串模版能够正常获取数据集的数据
  2. dataset数据集解决这个重叠的bug

Environment

OS: Windows 10 רҵ�� x86_64
Host: System manufacturer
Kernel: 10.0.19045
Uptime: 1 day, 2 hours, 7 mins
Packages: 2 (scoop)
Shell: bash 4.4.23
Resolution: 1920x1200, 1920x1080
DE: Aero
WM: Explorer
WM Theme: Custom
CPU: Intel i5-6500 (4) @ 3.200GHz
GPU: Caption
GPU: OrayIddDriver Device
GPU: Intel(R) HD Graphics 530
GPU: NVIDIA GeForce GTX 1050 Ti
GPU
Memory: 15954MiB / 24431MiB

Any additional comments?

No response

@Corps-Yan Corps-Yan added the bug label May 10, 2024
@echarts-bot echarts-bot bot added the pending We are not sure about whether this is a bug/new feature. label May 10, 2024
Copy link

echarts-bot bot commented May 10, 2024

@Corps-Yan 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] The dataset data with the same name overlaps, and the tooltip formatter string template cannot access the dataset data

BODY

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html

Steps to Reproduce

image

Current Behavior

option = {
legend: {},
tooltip: {
formatter: '@{product} @{2015} {c0}'
},
dataset: {
// Provide a copy of the data.
source: [
['product', '2015', '2016', '2017'],
['Matcha Latte', 43.3, 85.8, 93.7],
['Milk Tea', 83.1, 73.4, 55.1],
['Milk Tea', 83.1, 73.4, 55.1],
['Cheese Cocoa', 86.4, 65.2, 82.5],
['Walnut Brownie', 72.4, 53.9, 39.1]
]
},
//Declare an X-axis, category axis. By default, the category axis corresponds to the first column of the dataset.
xAxis: { type: 'category' },
// Declare a Y axis, a value axis.
yAxis: {},
// Declare multiple bar series. By default, each series will automatically correspond to each column of the dataset.
series: [{ type: 'bar' }]
};

Expected Behavior

  1. The tooltip string template can obtain the data of the data set normally.
  2. The dataset solves this overlapping bug

Environment

OS: Windows 10 x86_64
Host: System manufacturer
Kernel: 10.0.19045
Uptime: 1 day, 2 hours, 7 minutes
Packages: 2 (scoop)
Shell: bash 4.4.23
Resolution: 1920x1200, 1920x1080
DE:Aero
WM: Explorer
WM Theme: Custom
CPU: Intel i5-6500 (4) @ 3.200GHz
GPU: Caption
GPU: OrayIddDriver Device
GPU: Intel(R) HD Graphics 530
GPU: NVIDIA GeForce GTX 1050 Ti
GPU
Memory: 15954MiB / 24431MiB

Any additional comments?

No response

@helgasoft
Copy link

tooltip.formatter templates are different from label.formatter
Demo       📌 please close issue if problem solved.

@Corps-Yan
Copy link
Author

tooltip.formatter templates are different from label.formatter Demo       📌 please close issue if problem solved.

I understand that the formatter of the tooltip is not supported, but what about the issue of data folding with the same name? Shouldn't there be two Milk Tea bars in the demo?

@helgasoft
Copy link

Shouldn't there be two Milk Tea bars in the demo?

yes, there are two bars in your code, but they overlap 100% since their data is identical. If you change the second 'Milk Tea' value from 83.1 to 44.4, you'll see two bar labels. Demo

image

@Corps-Yan
Copy link
Author

there are two bars in your code, but they overlap 100% since their data is identical.

Thank you for your answer, but I still think this is a bug. If the label is not displayed, I cannot correctly map the data because there is a missing bar.

@helgasoft
Copy link

helgasoft commented May 11, 2024

one way of showing overlapping bars - Demo

image
Another way is to add data labels only for overlapping bars.
See also #8125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

2 participants