mkf62 opened a new issue, #21216: URL: https://github.com/apache/echarts/issues/21216
### Version 6.0.0 ### Link to Minimal Reproduction https://echarts.apache.org/examples/en/editor.html?code=MYewdgzgLgBAHgNQIYBsCuBTCMC8MDaAjAAzEA0MhAHAMwUBM1FNLFALAOxUC6A3AFChIsOABkkAIwwpseRKkwQAdAFskABwAUmuAEpcAPngwAVDACsugfxDqoAS3C4YAb34x4AQTj2IALld3DxgoAE91DACAcgA3BQwosiCPJB8IUXswSMDg4IgACxAAdwCoACdMJNyPcAAtDDKQb18ASTAAEww4AMJkmABfKuDU3wAVe2AAawC3apgC4tKKjCHc4DRoEBVkdCwA-V2IPsG-kfTJaRm-j3XN7fj_eB3FVeCAMxAytSgoBoC3tBgYAOJyaOIoCiZTp6HJzGBCCAgFAYJQoEAAc00AAM2tCYL4AgASFxQrr9LFWa7BMoYKBoMpgeDiKQyfCkuDcJRQEAAZXKmUxlLm_WOQROHlCzUes2CYQi0XBmCiYqGEAa9j2BD6Mty7SQUCQAXwVI8RFIFEIADZiNxXrkiOZyDB6GwbXbgkRaBa2OZbSaCPRzc6aGw_XCA0xnfQeO7TfRzPRmMRCGG4fgaEHCD7U3N06wozQc9V0z6LeYOEX7ZwqAwODaqZWQuFslEUJkEqKPNx-P1eEA ### 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 ```markdown - OS: MacOS Sequoia v15.6 - Browser: Chrome v139.0.7258.128 - Framework: React 18.2 ``` ### Any additional comments? The simple workaround (at least in my demo) is to just do ```javascript 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
