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

Rendering issue for Background color (Gradient and Opacity for solid color) #11310

Open
dinorahto opened this issue May 25, 2023 · 13 comments
Open

Comments

@dinorahto
Copy link

Expected behavior

We are expecting Charts (Line Charts) with a solid background color that doesn't blink when getting filled out by the color

Example of expected look inside our views (we were expecting a gradient, but we switch it to a solid color)
Screenshot 2023-05-25 at 12 53 31 p m

Current behavior

Using the next configuration for our dataSets:

const datasets = [ { label: 'Total', data: subtotalAmountData, fontColor: '#6B7280', pointBackgroundColor: '#1C64F2', pointBorderColor: '#1C64F2', fill: 'start', pointRadius: 3, backgroundColor: 'rgba(28, 100, 242, 0.5)', borderColor: 'rgba(28, 100, 242)', }, ];

We are seeing that our charts are looking with a little lag in the rendering, last for a second, and once the user scroll or clicks on it is gone

Screenshot 2023-05-25 at 12 55 23 p m Screenshot 2023-05-25 at 12 55 19 p m Screenshot 2023-05-25 at 12 53 31 p m

Reproducible sample

https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgYQBYENZwL5wGZQQhwDkAxhrAHQBWAziQNwCwAUGwG6ZxkwAecALxwAJhDIBXEAFMAdjCoBzaTACiAG2kz5AIQCeASREAKAEQg9aTDFMBKOOjpwAEgBUAsgBlk6WVzoaWnIwLKxcUHAWVljCstIA7iiUMMa8fAA0iGxwOXAwemDSAFyk6sBxJOnZuSLoMOglCNW5ueroAEbS6nQlANqmAErSIqaZpjrqEtKjcKYAml3qEPEzpgDiUNJyqwAKElBgmqsA8lC+yqYAulWsLS219XQqPXC9Tbd3n22d6iUkAMRwCB4OAANQgMGkDBun0+DwarwAjAAmTKIgCcmQAzJkAKyZVFwLHXZp3bCXUnYGG5CBgGDACCyF7vT50MjoTTM0ktPiNbl3fk5KmCuB6PkfWFwEXYfkyiU4NjYWyMIAa

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

^5.2.0

Browser name and version

react-chartjs-2

Link to your project

No response

@LeeLenaleee
Copy link
Collaborator

LeeLenaleee commented May 25, 2023

Chart.js does not have a version 5.2, current max version is 4.3.0.

But from your screenshots that looks like a rendering issue in chrome, seems verry similiar to another issue where it was like that. But it is hard to confirm without a reproducible sample

@RobinTail
Copy link

RobinTail commented Jun 19, 2023

I'm experiencing the same issue with a gradient.
I noticed that it happens in Chrome, but NOT in Safari.

Chart.js v3.9.1.
Chrome v114.0.5735.106 (Official Build) (arm64)
Safari v16.5 (18615.2.9.11.4)

Here are screenshots from Chrome:

Screenshot 2023-06-19 at 12 23 32 Screenshot 2023-06-19 at 12 26 50

@RobinTail
Copy link

Seems to be the duplicate of #10727

@RobinTail
Copy link

It seems that the issue comes from the growing line animation.
When its shape is rising from the bottom it may leave those gaps.

I can confirm that it's possible to resolve the issue by setting { animation: false } config option.
However, it does not feel as cool as before. Consider it as a temporary solution.

@RobinTail
Copy link

Perhaps, there is a way to adjust the default animation to avoid that painting issue on Chrome.
Please let me know if you tried something like that.

@RobinTail
Copy link

RobinTail commented Jun 19, 2023

Good news.

Perhaps the issue can be resolved by changing the setting the animation.easing to easeInElastic (while keeping the standard 1000 of the duration).

However, the animation itself is a bit weird for charts :)

Here are the results of my experiment.

animation.easing Outcome
easeOutQuart (default) easeOutQuart
linear linear
easeOutQuint easeOutQuint
easeOutCirc easeOutCirc
easeInOutQuint easeInOutQuint
easeInOutElastic easeInOutElastic
easeInCirc easeInCirc
easeInQuad easeInQuad
easeInExpo easeInExpo
easeInElastic easeInElastic

@comictvn
Copy link

comictvn commented Jul 8, 2023

I'm also facing the issue. is there any solution?

@etimberg
Copy link
Member

etimberg commented Jul 8, 2023

@comictvn likely nothing that will work for everyone. This is likely a rendering problem inside the browser. I know that chrome used to switch between hardware and software rendering around a canvas size of 256x256px. Does the bug reproduce for you when the canvas is both small and large?

@comictvn
Copy link

comictvn commented Jul 8, 2023

@etimberg thank you! disabling animation is a temporary solution for now. the issue is happening even small and big size of canvas.

@Enes5519
Copy link

Enes5519 commented Aug 2, 2023

Turning off animations didn't work

@leovolving
Copy link

I know this won't work for everyone's use case, but I was able to fix it reliably at multiple screen sizes by removing the tension setting. I previously had tension: 0.1

I was also able to get it to work by setting maintainAspectRatio back to true, but that wasn't a good option for my use case because I have a fixed height.

@midthun
Copy link

midthun commented Feb 3, 2024

Also seeing this issue in Chrome, turning off tension works, but I would like to be able to use smoother curves.

With tension:
image

Without tension:
image

Changing easing function or turning off animations did not work for me.

@unhyif
Copy link

unhyif commented May 26, 2024

In my case, it occurs when it is approximately 330px or more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants