grofit / aurelia-chart

A chart element for aurelia which is powered by chart js using html5 canvas.
MIT License
46 stars 25 forks source link

Update Plugin #2

Closed plwalters closed 8 years ago

plwalters commented 8 years ago

Hi @grofit when you have a chance can you update this to latest (beta)?

grofit commented 8 years ago

I am unfortunatly not able to get much time to read up on the changes atm, if anyone else wants to do it as a merge request I am happy to accept it.

weagle08 commented 8 years ago

i had actually started working on a wrapper of this before i knew it existed, i've gone back and since used some of the concepts from your code and can create a pull request once i've completed it.

weagle08 commented 8 years ago

so i've finished a wrapper that allows user to update everything via bindings (what was broken in this current branch) but my tool tips are not showing... think you could take a look grofit and see if anything stands out before i place in this repo and create a pull request? (fyi did not implement the previous version attributes, just has the custom element) https://github.com/weagle08/aurelia-chartjs

grofit commented 8 years ago

This plugin is based upon my knockout one (https://github.com/grofit/knockout.chart which does handle update bindings) but I remember there being some problem with ObserverLocator or something which made it hard to express a solution back in the earlier versions of Aurelia, this may have improved now. I have recently had a kid so my time spent doing my own stuff is FAR less than it was, so I will try to find some time to take a look over how you have handled the observable subscriptions (as that is really the only reason why this plugin does not handle updates).

There is a plunker I made at the time which shows the issue I as facing I think:

http://plnkr.co/edit/aBwv9O?p=info

Not sure if that is helpful, hopefully it is a moot point now.

grofit commented 8 years ago

I tried to get some info in the gitter but no one responded, if you guys can confirm the Correct way to subscribe to a property changing on a model I can probably just fix up the issue in the model-observer.js file (as that is the only issue with this to my knowledge) and it should all just work.

In your lib you get the PropertyObserver which may be the new way of doing it all but I cannot find any docs anywhere on the subject. Also on a side note it would be great if there was now an easier way to have local jspm resolution so I could package an example with this project.

weagle08 commented 8 years ago

Docs? Wouldn't we all love that!? The devs say they are working on some updated more in-depth documentation, but until then all i can say: the accepted way now is to inject BindingEngine and then use bindingEngine.propertyObserver(context, 'property').subscribe(callback) the subscribe now returns the subscription object which you can later dispose

Yeah, the local jspm thing has been a pita for me as well.

grofit commented 8 years ago

ok great, well I can give that way a try later and see if I can get it working, if so then we are good to go.

It is SUPER difficult/pita to provide any demos or use cases with any of the plugins I have made due to the way JSPM resolves stuff, which also makes it harder to test stuff as I need to hook it up to some other project or attempt to use the local linking system which is balls when it comes to constantly updating local libs.

With knockout it is super easy to just include it with your plugin and off you went, but KO is just a binding system, not an eco system.

grofit commented 8 years ago

Right I have made most of the code changes and got it running locally so I can at least test it. Although I cannot seem to get the model observer injected I just keep getting the error:

Unhandled promise rejection Error: Error invoking ModelObserver. Check the inner error for details.
------------------------------------------------
inner error: Error: key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?
    at Container.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:426:15)
    at Object.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:300:33)
    at Container.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:512:31)
    at StrategyResolver.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:155:37)
    at Container._get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:455:41)
    at Container.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:444:28)
    at Container.elementContainerGet [as get] (http://localhost:3000/jspm_packages/github/aurelia/templating@0.16.0/aurelia-templating.js:1469:17)
    at Object.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:300:33)
    at Container.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:512:31)
    at ProviderResolver.get (http://localhost:3000/jspm_packages/github/aurelia/templating@0.16.0/aurelia-templating.js:1425:74)
    at Container.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:426:15)
    at Object.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:300:33)
    at Container.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:512:31)
    at StrategyResolver.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:155:37)
    at Container._get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:455:41)
    at Container.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:444:28)
    at Container.elementContainerGet [as get] (http://localhost:3000/jspm_packages/github/aurelia/templating@0.16.0/aurelia-templating.js:1469:17)
    at Object.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:300:33)
    at Container.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:512:31)
    at ProviderResolver.get (http://localhost:3000/jspm_packages/github/aurelia/templating@0.16.0/aurelia-templating.js:1425:74)
    at new AggregateError (http://localhost:3000/jspm_packages/github/aurelia/pal@0.2.0/aurelia-pal.js:20:13)
    at Container.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:514:15)
    at StrategyResolver.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:155:37)
    at Container._get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:455:41)
    at Container.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:444:28)
    at Container.elementContainerGet [as get] (http://localhost:3000/jspm_packages/github/aurelia/templating@0.16.0/aurelia-templating.js:1469:17)
    at Object.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:300:33)
    at Container.invoke (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:512:31)
    at ProviderResolver.get (http://localhost:3000/jspm_packages/github/aurelia/templating@0.16.0/aurelia-templating.js:1425:74)
    at Container.get (http://localhost:3000/jspm_packages/github/aurelia/dependency-injection@0.11.2/aurelia-dependency-injection.js:447:23)
grofit commented 8 years ago

Just to update this further, I have managed to get a working version of all this with observable support etc, just cannot get a working demo version of it working, so am holding off until that is done before I commit it up into master.

grofit commented 8 years ago

Rejoice all the plugin has been updated and now has an example with it since release:

https://github.com/grofit/aurelia-chart/releases/tag/0.1.0