Closed tom1980west closed 8 years ago
Possibly, I only updated this a week or so ago, I am pretty sure you dont need the "grofit/aurelia-chart"
and just need aurelia.user.plugin("aurelia-chart");
, give that a try and see if it still blows up.
Manage to resolve it - don't believe it was an issue with your library as removing all of the JSPM packages and re-installing them seem to fix it, as stated here.
One question I do have. I can get it working with a static dataset, but if I bind it via an fetch call to a web service, the chart is binding before the promise is completed. Is there a way to debounce the bind? I've tried playing around with the should-update flag, but it doesn't seem to help.
The should-update
flag basically triggers a model walk and all properties which are subscribable are subscribed to within a group, so basically if any of them change, it triggers a single subscription callback (all handled internally).
So if you are replacing the entire data model I imagine the should-update
would not help as the existing subscriptions would no longer be applicable (could also be a possible memory leak), then when the new data is set it would probably trigger the binding again which may reset everything.
Ultimately you should only update the model when you have data, so your promise should be something like:
doSomeAjaxCall()
.then((result) => {
someViewModel.chartData = result;
});
I don't know how your promise stuff works but it would be odd for the data in the model to "change" during a promise, you generally set it once you get the data from the request, the only scenario I can think of is that you are assigning the actual promise to the data variable (which I would probably say is bad) and then a the end of the promise you return out the data. If this is the case I would suggest you just set the data at the end of your promise has actioned.
(Will close this issue but feel free to continue this conversation here or pm me on the aurelia gitter)
When I include the aurelia.use.plugin("grofit/aurelia-chart"); in my solution, I get the following exception from the browser:
I presume as I'm on the latest version of Aurelia, there are some breaking changes in there that have caused this?
I'm pretty new to this stuff, so not really sure how to proceed.