echarts
echarts copied to clipboard
Tooltip shows wrong data in step chart
问题简述 (One-line summary)
When using a stack line chart where both axis are 'value' axis, the tooltip displays nearest value point which is wrong for the step
版本及环境 (Version & Environment)
- ECharts 版本 (ECharts version):
- 浏览器类型和版本 (Browser version):
- 操作系统类型和版本 (OS Version):
重现步骤 (Steps to reproduce)
- Run chart with options below
- Hover over single "step"... see that it display two different values depending on if you are on the left side of the "step" or the right side. Here are screenshots:

期望结果 (Expected behaviour)
The tooltip should only be displaying the value relevant for that step. Tooltip can only trigger by 'axis' or 'item' (based on docs https://ecomfe.github.io/echarts/doc/doc-en.html#Tooltip) but neither give the right behavior. The toolTip should have a trigger type of 'step' that will know the correct value for the step, whether 'step' = 'start|middle|end' for each series (because there can be multiple series even overlayed on top of one another).
可能哪里有问题 (What went wrong)
ECharts配置项 (ECharts option)
option = {
"color": [
"green",
"red"
],
"tooltip": {
"trigger": "axis",
"showDelay": 0
},
"xAxis": [
{
"type": "value",
"scale": true,
"boundaryGap": false,
"splitNumber": 20,
"axisLabel": {
"show": false
}
}
],
"yAxis": [
{
"type": "value",
"scale": false,
"boundaryGap": false
}
],
"series": [
{
name: 'Values',
type: 'line',
step: 'start',
stack: 'values',
itemStyle: {normal: {areaStyle: {}}},
"data": [
[
"0.0180500",
50
],
[
0.0181,
40
],
[
0.018150000000000003,
30
],
[
0.018200000000000004,
20
],
[
0.018250000000000006,
10
],
[
0.018250000000100006,
0
]
]
}
]
}
其他信息 (Other comments)
Thanks for any help!