Fix/toolbox selection chart rerender
Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
What does this PR do?
Prevents unnecessary chart re-rendering when clicking toolbox buttons (brush, dataZoom selection tools) by skipping series rendering for takeGlobalCursor actions.
Fixed issues
- Fixes performance issue where clicking toolbox selection buttons caused entire chart to re-render with progressive animation, especially problematic with large datasets (10,000+ points)
Details
Before: What was the problem?
When users clicked toolbox buttons like "Box Select" (brush rect) or dataZoom selection tools, the entire chart would re-render including all series data points. This triggered:
- Progressive rendering animation replaying from scratch
- Significant performance degradation with large datasets
- Poor user experience as the chart appeared to "reload" just to change cursor mode
Root Cause: The takeGlobalCursor action was registered with update: 'update', which triggered the full update pipeline including render() → renderSeries(), causing all chart series to re-render even though only UI state (toolbox icons, brush controller) needed updating.
Investigation Journey:
- Initially tried changing
update: 'update'toupdate: 'none'and manually calling component updates in a custom action handler - This worked but required complex manual orchestration of brush model updates and view updates
- Then attempted
update: 'toolbox:updateView'and other targeted update strategies - Realized the issue: we needed components to update (toolbox, brush) but NOT series to render
After: How does it behave after the fixing?
Clicking toolbox buttons now:
- ✅ Instantly activates the tool (brush/dataZoom selection) without any re-rendering
- ✅ Updates toolbox icon states correctly (emphasis/normal)
- ✅ Enables/disables brush controllers properly
- ✅ No progressive animation or performance impact
- ✅ Works seamlessly with large datasets
The Fix: Added a simple early return in the render() function to skip series rendering when the payload type is takeGlobalCursor:
if (payload && payload.type === 'takeGlobalCursor') {
return;
}
i am attaching a video of the fix
https://github.com/user-attachments/assets/81e51d28-7509-481c-9355-da283356b119
Thanks for your contribution! The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.
Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.
To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: PR: doc ready, PR: awaiting doc, PR: doc unchanged
This message is shown because the PR description doesn't contain the document related template.