fix(axis): refactor axisLabel formatter#21432
Conversation
|
Thanks for your contribution! The pull request is marked to be |
There was a problem hiding this comment.
Pull request overview
This PR refactors the createAxisLabels function to eliminate an unnecessary indexOf call within a map operation. The change improves both code clarity and performance by utilizing the index parameter that map already provides.
Key Changes:
- Removed redundant
indexOfcall that was performing O(n) lookup on each map iteration - Added
indexparameter to themapcallback function to directly access the iteration index
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21432@921496a |
|
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
https://github.com/apache/echarts/pull/21220/changes#r2622525473
Brief Information
This pull request is in the type of:
What does this PR do?
Refactor to remove the
indexOfcall.Fixed issues
Details
Before: What was the problem?
indexOfshould not be necessary.After: How does it behave after the fixing?
Use the
indexfrommapfunction`.Document Info
One of the following should be checked.
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
N.A.
Merging options
Other information