Srajan-Sanjay-Saxena opened a new pull request, #21375:
URL: https://github.com/apache/echarts/pull/21375
<!-- Please fill in the following information to help us review your PR more
efficiently. -->
## 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:**
1. Initially tried changing `update: 'update'` to `update: 'none'` and
manually calling component updates in a custom action handler
2. This worked but required complex manual orchestration of brush model
updates and view updates
3. Then attempted `update: 'toolbox:updateView'` and other targeted update
strategies
4. 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`:
```typescript
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
--
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]