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

charts appear blur on canvas - make crisp #13504

Open
anoosurf opened this issue Oct 28, 2020 · 11 comments
Open

charts appear blur on canvas - make crisp #13504

anoosurf opened this issue Oct 28, 2020 · 11 comments
Labels
en This issue is in English enhancement
Milestone

Comments

@anoosurf
Copy link

Version

4.9.0

Steps to reproduce

show any bar chart on different screen resolutions / pixel ratio it shows blur on edges

What is expected?

it should be crisp like highcharts.com or svg borders

What is actually happening?

the dimensions are in float number and not rounded

@echarts-bot
Copy link

echarts-bot bot commented Oct 28, 2020

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added bug en This issue is in English pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Oct 28, 2020
@anoosurf
Copy link
Author

image

@anoosurf
Copy link
Author

image

@anoosurf
Copy link
Author

maybe a solution could be rounding of the drawing rectangle dimensions and/or shifting of canvas context to adjust for half pixel?
please do assist ASAP as this will make the charts even more great to look at :)
thanks

@plainheart
Copy link
Member

Could you please try to check if this issue exists in 5.0? You may use the version 5.0.0-beta.2.

@anoosurf
Copy link
Author

anoosurf commented Oct 29, 2020 via email

@plainheart
Copy link
Member

plainheart commented Oct 29, 2020

Thanks for the check. Just found you had gotten involved in this issue in #8620. It may still take some time to fix it.

@plainheart plainheart added this to the TBD milestone Oct 29, 2020
@plainheart plainheart added enhancement and removed bug pending We are not sure about whether this is a bug/new feature. labels Oct 29, 2020
@TaylorPzreal
Copy link

Is there has a version that doesn't has this error?
my echarts version is 4.9.0 and has this same error;

@TaylorPzreal
Copy link

After i read zrender source code, i found how to trigger this problem in my case;

First the zrender src/config.ts portion code:

let dpr = 1;

// If in browser environment
if (typeof window !== 'undefined') {
    dpr = Math.max(window.devicePixelRatio 
    	|| ((window.screen as any).deviceXDPI / (window.screen as any).logicalXDPI) 
    	|| 1, 1);
}

As you can see, zrender use window.devicePixelRatio to set pixel almost any time in today browser if you don't config this, and my case is:

First i displayed my webpage on a low pixel screen(1PX), and then i dragged the browser to mac screen(2PX), so i found this problem.

So it's okay for me. Just for sharing my case.

@rajsite
Copy link

rajsite commented Aug 31, 2022

I see similar issues in the charts examples if I zoom the browser:

echarts

Notice that when I refresh the page the echart reloads and sees the new devicePixelRatio and looks sharp again. I think the issue is that echarts needs a way to allow for monitoring changes to the devicePixelRatio dynamically.

MDN has an example for Monitoring screen resolution or zoom level changes which should help for the browser zoom use-case I show.

@mballav
Copy link

mballav commented Feb 8, 2023

I am facing the same issue when trying to produce high-quality PDFs using puppeteer. While other items on the web page look crisp even when zoomed in to 300% or more, the charts look blurry, as you can see below:

image

Could you please take this enhancement up in the next release? It's really important for us to deliver high-quality reports to our clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English enhancement
Projects
None yet
Development

No branches or pull requests

5 participants