Skip to content

Conversation

@Justin-ZS
Copy link
Contributor

@Justin-ZS Justin-ZS commented Jan 22, 2026

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Auto update devicePixelRatio on resize() to fix blurry chart after browser zoom.
Zoom in to 500% and call resize().
Before:
截屏2026-01-22 17 15 14
After:
截屏2026-01-22 17 13 53

Fixed issues

Details

Before: What was the problem?

When browser zoom changes, calling chart.resize() does not update devicePixelRatio, resulting in blurry charts.

After: How does it behave after the fixing?

resize() now defaults to use window.devicePixelRatio, so charts automatically become crisp after browser zoom.

Document Info

  • The document should be updated later

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

Related test cases or examples to use the new APIs

Merging options

  • Please squash the commits into a single one when merging.

Other information

N.A.

@echarts-bot echarts-bot bot added PR: awaiting doc Document changes is required for this PR. PR: awaiting review labels Jan 22, 2026
@echarts-bot
Copy link

echarts-bot bot commented Jan 22, 2026

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.

Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

This PR depends on ZRender changes. Please update the ZRender dependency to the latest nightly version including this change, which takes place everyday at 8:00 UTC (16:00 Beijing Time).
You can use npm i zrender@npm:zrender-nightly@dev to update package.json.
If you have any question about this, please leave a comment and we will give you extra help on this.

@Justin-ZS Justin-ZS requested a review from plainheart January 22, 2026 09:39
@github-actions
Copy link
Contributor

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21489@d6f8218

@plainheart plainheart changed the title feat(drp): use current dpr when resize feat(core): use current device pixel ratio when resize Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: awaiting doc Document changes is required for this PR. PR: awaiting review size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant