angularjs - Initializing Chart Js Multiple times for and Array of Objects -
as title suggests here snippet of code
angular.foreach($scope.students,function(){ var ctx = document.getelementbyid("mychart").getcontext("2d"); var myradarchart = new chart(ctx).radar(chartdata); //data// var subjects = []; var scores = []; angular.foreach(mydata.subjects, function(subject){ subjects.push(mydata.subject.name); }); angular.foreach($scope.data.subjects, function(score){ scores.push(score.grades.assignments+score.grades.tests+score.grades.final); }); var chartdata = { labels : subjects, datasets : [ { data: scores, fillcolor: color2, strokecolor: color1, pointcolor: color1, pointstrokecolor: color1, pointhighlightfill: "#fff", pointhighlightstroke: "rgba(220,220,220,1)" } ] }; }); }]);
i have else working im not sure how initialize each chart uniquely each object in data.json , have look
i use directive , looks there's already 1 out there chart.js , angularjs. way can set data each chart.
Comments
Post a Comment