-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Closed
Labels
Description
Version
6.0.0
Link to Minimal Reproduction
Steps to Reproduce
Create a simple line chart with zoom enabled and use tooltip.valueFormatter to format the value. Zoom in on a few points of the chart.
data = [
["2016-10-4", 1],
["2016-10-5", 2],
["2016-10-6", 3],
["2016-10-7", 4],
["2016-10-8", 5],
["2016-10-9", 6],
["2016-10-10", 7],
["2016-10-11", 8],
["2016-10-12", 9]
];
option = {
tooltip: {
trigger: "axis",
valueFormatter: (_value, dataIndex) => {
const valueFromData = data[dataIndex][1];
const symbol = valueFromData == _value ? '=' : '!=';
return`${_value} ${symbol} ${valueFromData}`;
}
},
toolbox: {
feature: {
dataZoom: {
}
}
},
dataZoom: {
type: "inside"
},
xAxis: {
type: "time"
},
yAxis: {
type: "value"
},
series: [{
name: "test",
type: "line",
data
}]
}Current Behavior
When using dataIndex to get the raw value from underlying data array, the value retrieved is wrong when I zoom onto a few points. It looks like dataIndex is only considering the points displayed on the chart , i.e. it's 0 for the first visible point with the zoom on but it prevents me from using it to retrieve the raw value from the underlying data array.
Expected Behavior
I expect the dataIndex to refer to the absolute index of the value within the underlying data array, no matter what the zoom context is.
Environment
- OS: macOS Tahoe 26.2
- Browser: Chrome 142.0.7444.176
- Framework: AngularAny additional comments?
No response
Reactions are currently unavailable

