Skip to content

Conversation

@Srajan-Sanjay-Saxena
Copy link
Contributor

Brief Information

This pull request is in the type of:

  • 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:

if (payload && payload.type === 'takeGlobalCursor') {
    return;
}

i am attaching a video of the fix

2025-11-15.01-18-41.mp4

@echarts-bot
Copy link

echarts-bot bot commented Nov 14, 2025

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.

@Srajan-Sanjay-Saxena Srajan-Sanjay-Saxena force-pushed the fix/toolbox-selection-chart-rerender branch from 165facc to 19e7eb4 Compare November 15, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants