adopted-ember-addons / ember-cli-chart

A simple ember component for adding Charts
https://www.npmjs.org/package/ember-cli-chart
MIT License
138 stars 75 forks source link

Working example with all the files? #57

Closed adityasingh-ruckus closed 7 years ago

adityasingh-ruckus commented 8 years ago

Hi,

I am trying to set up my new app and I am not able to find a working example. Can you please share a demo link with all its source code?

Thanks

alyakan commented 8 years ago

I'm facing the same problem however I was able to get the line and doughnut/pie charts to work. What I did is that i opened the source file called Chart.js found in bower_components/chartjs/Chart.js and searched for the required attribute names and tried to figure out the format of data. There are also files for each type of chart called Chart.Bar.js etc.. however modifying them would have no effect, they're just used as some sort of archiving.

The thing is this module is using an old version of Chart.js, I'll try to post my working examples soon, however I'm really busy these couple of days because of my bachelor thesis :) @adityasingh-ruckus

adityasingh-ruckus commented 8 years ago

Hi @alyakan Thanks for your response. Even I was able to get it working, unfortunately I can't get it to work in my template files, except for application.hbs.

To give a small example, I am using mirage to populate dummy data, if I want to populate the same data in charts for my templates, I can't do that. I will really appreciate your help!

aomran commented 8 years ago

There is a link from the chartjs docs to the old version docs: https://github.com/chartjs/Chart.js/tree/v1.1.1/docs

alyakan commented 8 years ago

Oh my god thanks :)

adityasingh-ruckus commented 8 years ago

Hi,

I was able to get it working, but now I am facing a new issue.This never seems to end :) So my problem is that instead of requesting data from the controller, I need the same data which is in routes. I am not able to use the ''client_details'' variable. Any help will be appreciated. @aomran @alyakan Below is what my routes code snippet looks like.

export default Ember.Route.extend({ model: function(){ var client_details = this.store.findAll('client'); return client_details; }, pieData: Ember.computed(client_details, function(){ return [ { value: parseInt(200), color:"#F7464A", highlight: "#FF5A5E", label: "Red" }, { value: parseInt(50), color: "#46BFBD", highlight: "#5AD3D1", label: "Green" }, { value: parseInt(20), color: "#FDB45C", highlight: "#FFC870", label: "Yellow" } ]; }) });