n3-charts / pie-chart

Yummy pies and donuts for AngularJS
n3-charts.github.io/pie-chart/
MIT License
187 stars 73 forks source link

Using string interpolation for the data attribute value of the pie-chart directive. #9

Open jstralko opened 9 years ago

jstralko commented 9 years ago

I need to generate a number of pie charts dynamically based on data from a database. So I don't know how many pie charts I need to create so I need the data attribute to be string that is generated via string interpolation.

This way gives a syntax error:

I tried to modify the custom pie directive to something like this in the link function:

$parse(attrs.data)($scope.$parent);

But I get the following error: TypeError: u.map is not a function at Object.n as pie at Object.updatePaths (pie-chart.js:100) at draw (pie-chart.js:44) at hard_update (pie-chart.js:30) at Object.fn (pie-chart.js:56) at n.$get.n.$digest (angular.js:14308) at n.$get.n.$apply (angular.js:14571) at l (angular.js:9698) at M (angular.js:9888) at XMLHttpRequest.F.onload (angular.js:9829)

Am I overlooking something simple or does the pie-chart directive not support this use case?

Anyways thanks for the help!

hellsan631 commented 8 years ago

The data that is being sent into the chart isn't an array, which it needs to be.