feat(canvas): update devicePixelRatio to prevent chart being blurry after resizing#21489
Conversation
|
Thanks for your contribution! 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 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). |
|
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-21489@a29afe9 |
59327bc to
a29afe9
Compare
a29afe9 to
66901e6
Compare
|
@plainheart Could you help to review ? Thanks! |
|
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
devicePixelRatio to prevent chart being blurry after resizing
|
Doc PR: apache/echarts-doc#514 |
Brief Information
This pull request is in the type of:
What does this PR do?
Auto update


devicePixelRatioonresize()to fix blurry chart after browser zoom.Zoom in to 500% and call
resize().Before:
After:
Fixed issues
Details
Before: What was the problem?
When browser zoom changes, calling
chart.resize()does not updatedevicePixelRatio, resulting in blurry charts.After: How does it behave after the fixing?
resize()now defaults to usewindow.devicePixelRatio, so charts automatically become crisp after browser zoom.Document Info
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
Merging options
Other information
This PR also includes a small CI workflow fix for the
lintjob. The job restoresnode_modulesfrom cache and skipsnpm cion cache hits, butnpm ciis the step that normally runsprepare -> build:liband generatestypes/dist/echarts. Without regenerating those type files,npm run checktypecan fail withCannot find module './types/dist/echarts'.To make the PR check deterministic, the workflow now runs
npm run build:libexplicitly beforenpm run checktype.