### Version 2.0.19 ### Link to Minimal Reproduction https://www.visactor.com/vchart/playground?specId=4144852520×tamp=1774424993291&version=2.0.19&theme=light&demoType=react ### Steps to Reproduce 滚动到 100 多位后,左轴标签位置错误 ### Current Behavior <img width="518" height="356" alt="Image" src="https://github.com/user-attachments/assets/1578c91e-bf96-4fb8-a576-ba261635d0cb" /> ### Expected Behavior 布局正常 ### Environment ```markdown - OS: - Browser: - Framework: ``` ### Any additional comments? _No response_
Activity
adaelixir commentedon Mar 25, 2026
@xuefei1313 [formatMethod]里用来生成序号的[index]变量是在组件外部定义的闭包变量,通过 [index++]自增。
每次 VChart 需要重新渲染坐标轴标签(比如布局计算、滚动更新),就会调用 [formatMethod],而这些调用不会触发 React 重渲染,[index]不会被重置,一直往上累加。所以同一个 "杭州元通" 标签在不同时刻被调用时,拿到的 [index]值就会变。
修复方法:用数据在原数组中的位置来确定序号,而不是依赖可变计数器。
https://www.visactor.com/vchart/playground?specId=1485759273×tamp=1774430971476&version=2.0.19&theme=light&demoType=react