-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 do not update #568
Comments
+1 I really need this to be fixed. EDIT: I've looked into the code and tried to find the issue.. seems like the iterable differ (angular2) doesn't detect the changes. It returns 0 everytime and that's why the "if" to reinit the chart doesn't get executed. EDIT2: The problem I got is that when I change the datasets[x].data, it does not get detected by the changes-variable in chart.ts. When I set changes to "this.differs.diff(this.data.datasets[0].data)", it works just fine. I even tried setting a "updated" timestamp to my dataset and changed it everytime I changed the "data.dataset[0].data", but that does not get detected either. Seems like IterableDiffers have Issues with detecting changes on array properties. Changes DO get detected if you JUST push(xxx) into this.data.datasets. Creating a new dataset does make it get detected by the differ. BUT: Using a shift straight afterwards makes the differ NOT detecting it anymore. Seems like if the array.length before and after using methods on the array has the same value, changes do NOT get detected. However, I might have made mistakes, since I'm not an experienced programmer in any way. (started ~2month ago) |
Any comment on this would be awesome! |
I haven't looked at it as deep as you have... Great job, maybe the developers can find out the solution easier... |
Has anyone tried this with the latest Versions of Angular2? Does change detection work the way described in the previous posts? |
@cagataycivici |
@albertosramires Yesterday I wanted to write that it indeed does work, but today it just stopped. I didn't actually change anything. I uninstalled/reinstalled primeng and tried it with chartjs@2.3.0 as well, but it seems to be defect again. I don't know what happened. EDIT: Alrighty, I didn't notice, that there is RC6 & 7, those came quick. Well, in RC.5 it did work, yesterday I updated my packages. I'll try Rc5 again. EDIT 2: RC5 does work for me. @cagataycivici Looks like the ngDoCheck function was deleted in rc6/7. Not sure if that was intended. |
@albertosramires I perform .pop() and .slice() on my datasets.data, not the datasets array itself. I am sorry, I missread you there. You are right, pushing a completely new dataset into the datasets arrays doesnt work for me as well. |
@albertosramires That doesn't work for me. My charts are within different childcomponents, while my data gets updated in their parent. But it seems as if using the @ViewChild doesn't work here, it returns undefined. Sorry, if I do any stupid msitakes, I am very unexperienced. |
I did, but I can't get it to work. But thanks for your help! |
Similar issue: (EDIT: primeng@1.0.0) Calling But calling it after changing the value of Am I missing an initialization step somewhere?
|
@albertosramires Every second (4th, 6th etc). |
@albertosramires That did it. Even just a delay of 50ms made the difference. Thanks. |
I'm trying to update a chart, but not working just changing the values, and calling the function update fails since I don't know wha'ts the Chart.js instance:
The text was updated successfully, but these errors were encountered: