echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] dataset 同名数据重叠,且tooltip formatter 字符串模板无法访问数据集数据

Open Corps-Yan opened this issue 1 year ago • 6 comments

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 avatar May 10 '24 03:05 Corps-Yan

@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

echarts-bot[bot] avatar May 10 '24 03:05 echarts-bot[bot]

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

helgasoft avatar May 10 '24 19:05 helgasoft

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?

Corps-Yan avatar May 11 '24 05:05 Corps-Yan

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

helgasoft avatar May 11 '24 05:05 helgasoft

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.

Corps-Yan avatar May 11 '24 06:05 Corps-Yan

one way of showing overlapping bars - Demo

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

helgasoft avatar May 11 '24 07:05 helgasoft