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

Chart isn't updating with Response data (Chart.js: 3.2.1, ng2-charts: 3.0.0-beta.9) #1313

Closed
nerkess opened this issue May 8, 2021 · 6 comments
Assignees
Labels

Comments

@nerkess
Copy link

nerkess commented May 8, 2021

I am using Chart.js of version 3.2.1 and ng2-charts of version 3.0.0-beta.9. I was upgrading a project with this versions. I started with mock data and everything was ok: the charts were showing up as expected.

Until I started testing with the real data, I get from the backend. The axes, labels, legends are not updating and charts are not showing up.

I reproduced the problem here:
https://stackblitz.com/edit/chart-js-321-ng2-charts-300-beta9-rest?file=src%2Fapp%2Fapp.component.ts

@nerkess nerkess changed the title Chart isn't updating with Response data Chart isn't updating with Response data (Chart.js: 3.2.1, ng2-charts: 3.0.0-beta.9) May 12, 2021
@santam85 santam85 added the bug label May 17, 2021
@santam85 santam85 self-assigned this May 17, 2021
@santam85
Copy link
Contributor

@nerkess would you be able to try this again with 3.0.0-rc.1?

@nerkess
Copy link
Author

nerkess commented May 19, 2021

@santam85 Thank you for the reply!
I installed 3.0.0-rc.1 in my Stackblitz project, but without success:
https://stackblitz.com/edit/chart-js-321-ng2-charts-300-beta9-rest?file=package.json

@santam85
Copy link
Contributor

santam85 commented May 19, 2021

You can temporarily work around the issue by calling .render() instead of .update(). I will have a look in the meantime.

@nerkess
Copy link
Author

nerkess commented May 19, 2021

I was using chart.update()
With chart.render() the chart updates with versions 3.0.0-beta.9 and 3.0.0-rc.1

santam85 added a commit that referenced this issue May 20, 2021
@santam85
Copy link
Contributor

@nerkess released 3.0.0-rc.2 with a small fix for this. Tested it in your stackblitz and seems to work with .update() now (or even without it altogether, depending on the parameters used). You should get better performance with that.

@nerkess
Copy link
Author

nerkess commented May 22, 2021

@santam85 yes, it's working without update too, that's pretty cool 👍 thank you for your contribution!

@nerkess nerkess closed this as completed May 22, 2021
santam85 added a commit that referenced this issue Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants