Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(toolbox): use current device pixel ratio by default for exporting crisp and clear images. #14002

Merged
merged 1 commit into from
Jan 11, 2021

Conversation

plainheart
Copy link
Member

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Currently, we are using the default value 1 as the DPR instead of the real device pixel ratio of the user, which will make the exported image blurred in retina devices. To get a clear one, the user has to set the option as follows:

toolbox: {
    feature: {
        saveAsImage: {
            pixelRatio: 2.5 // specific dpr
        }
    }
}

This PR is intended to enable users to export a clearer image without any specific option.

Details

Before: What was the problem?

By default, the exported image is blurred in retina devices.

blurred

After: How is it fixed in this PR?

Don't specify the default pixelRatio as 1. Use the ECharts#getDevicePixelRatio() method to get the real dpr instead.

crisp

Usage

Are there any API changes?

  • The API has been changed.

Related test cases or examples to use the new APIs

Please refer to test/toolbox-title.html or any other case related to the toolbox.

Others

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Jan 11, 2021

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.

The pull request is marked to be PR: author is committer because you are a committer of this project.

@pissang pissang merged commit d38168e into master Jan 11, 2021
@echarts-bot
Copy link

echarts-bot bot commented Jan 11, 2021

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@pissang pissang added this to the 5.1.0 milestone Jan 11, 2021
@pissang pissang deleted the fix-export-dpr branch January 11, 2021 02:38
@pissang pissang modified the milestones: 5.1.0, 5.0.2 Jan 26, 2021
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.

None yet

2 participants