-
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
If using customValues for axisTick and axisLabel on xAxis of type: 'value', the axisLabel.formatter callback function doesn't receive index and instead only receives value. See demo which has a console.log statement called in the formatter function to see the value of the index (nothing will actually load on the chart due to the error it encounters in the formatter, but if you comment out formatter the chart will load fine).
Current Behavior
index is undefined.
Expected Behavior
index has a value based on the array used for customValues.
Environment
- OS: MacOS Sequoia v15.6
- Browser: Chrome v139.0.7258.128
- Framework: React 18.2Any additional comments?
The simple workaround (at least in my demo) is to just do
const xValues = [100, 183, 218, 333, 478];
const xLabels = xValues.map((x) => x * 5);
axisLabel: {
customValues: xValues,
formatter: function (value) {
const idx = xValues.indexOf(value)
return xLabels[idx].toString();
}
}but that defeats the purpose of the formatter callback that's supposed to receive the indexes.
Reactions are currently unavailable