-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Colors of points in line chart doesn't update when chart.update("none") is set #11507
Comments
Quick Fix for now =>
Looking into the issue |
So why to use chart.update("none") when chart.update() is working properly. |
Can we go about by manually changing the color for each dataset and after updation call chart.update()? |
Do you mean like this?
This works, but it still shows the wrong colors briefly in the animation |
|
I'm looking into it. |
function changeColors() {
} |
@AsgerMogensen Could you please help me as to where to make my changes? |
I'm not quite sure what to reply? This approach seems to work:
|
hi there , this is the reproducible sample of issue with fixes: |
@AsgerMogensen ok,so can i go about making the following changes? |
I'm still not sure what to reply. What am i confirming? Your solution changes the colors correctly, but it has occurred to me, that it's animated. There never was any problem when the update was animated. |
Expected behavior
I wrote a function that changes the colors of every dataset in the chart when a button is pressed. When pressed i would expect the color of the line, line fill, point and point fill to change with no animation because chart.update("none") is set.
How i expect the chart to look after color change (original color is black)
![billede](https://private-user-images.githubusercontent.com/38009346/270103733-6587e66a-2e96-4234-9715-440311fd3a0b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI2MDcxMTEsIm5iZiI6MTcyMjYwNjgxMSwicGF0aCI6Ii8zODAwOTM0Ni8yNzAxMDM3MzMtNjU4N2U2NmEtMmU5Ni00MjM0LTk3MTUtNDQwMzExZmQzYTBiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDEzNTMzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY2MjFhY2M2ZWQ5NWNlNDI1ZDA4ZTFiNGQ5ZDI5OTU2MjJhODYzZmQ1YTFiNWQ1MjI3OGNiMzI4YTZkOTUyZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9Ij-mYyXVe_poWoaEwg-KtQwOU12jHuBSeJPJqg44HM)
Current behavior
When i press the button the color of the line and line fill changes like it should, but the color of the point and point fill doesn't change. However when i hover over a point it shows the correct color and when i hide a dataset, the entire chart updates and all colors are then correct.
This only happens when chart.update("none") is set and not when just using chart.update().
Whether i use borderColor and backgroundColor or pointBorderColor and pointBackgroundColor the behaviour is the same
How the chart actually looks after color change (original color is black)
![billede](https://private-user-images.githubusercontent.com/38009346/270103786-48134f8a-fc91-4b05-8dd1-6535f4f00ef1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI2MDcxMTEsIm5iZiI6MTcyMjYwNjgxMSwicGF0aCI6Ii8zODAwOTM0Ni8yNzAxMDM3ODYtNDgxMzRmOGEtZmM5MS00YjA1LThkZDEtNjUzNWY0ZjAwZWYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDEzNTMzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRkMWZmZGY4NzUxNjU4ODYzZmIzNjFjNDE2NWQ4NDEzOTk0OWYzZTgzOGMzMTVmMGRiNGVjYWJmMGYwNGJmNzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CiGGQK2_VRgxzx0gzQibkFB5CGxF01BJO3zyeeFf3K4)
Reproducible sample
https://codepen.io/AsgMog/pen/zYyRWzz
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
I'm trying to create a button that changes the color of the chart without the change being animated.
chart.js version
v4.4.0
Browser name and version
Firefox 115.2.1esr
Link to your project
No response
The text was updated successfully, but these errors were encountered: