Built motion from commit 99feb03.|0.0.140
[motion.git] / public / bower_components / angular-chart.js / angular-chart.js
index c28f267..8375081 100644 (file)
@@ -2,9 +2,7 @@
   'use strict';
   if (typeof exports === 'object') {
     // Node/CommonJS
-    module.exports = factory(
-      typeof angular !== 'undefined' ? angular : require('angular'),
-      typeof Chart !== 'undefined' ? Chart : require('chart.js'));
+    module.exports = factory(typeof angular ? angular : require('angular'), require('chart.js'));
   }  else if (typeof define === 'function' && define.amd) {
     // AMD. Register as an anonymous module.
     define(['angular', 'chart'], factory);
             }
             if (! scope.data || ! scope.data.length) return;
             scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour;
-            var colours = getColours(type, scope);
+            scope.colours = getColours(type, scope);
             var cvs = elem[0], ctx = cvs.getContext('2d');
             var data = Array.isArray(scope.data[0]) ?
-              getDataSets(scope.labels, scope.data, scope.series || [], colours) :
-              getData(scope.labels, scope.data, colours);
+              getDataSets(scope.labels, scope.data, scope.series || [], scope.colours) :
+              getData(scope.labels, scope.data, scope.colours);
             var options = angular.extend({}, ChartJs.getOptions(type), scope.options);
             chart = new ChartJs.Chart(ctx)[type](data, options);
             scope.$emit('create', chart);
     }
 
     function getColours (type, scope) {
-      var notEnoughColours = false;
       var colours = angular.copy(scope.colours ||
         ChartJs.getOptions(type).colours ||
         Chart.defaults.global.colours
       );
       while (colours.length < scope.data.length) {
         colours.push(scope.getColour());
-        notEnoughColours = true;
       }
-      // mutate colours in this case as we don't want
-      // the colours to change on each refresh
-      if (notEnoughColours) scope.colours = colours;
       return colours.map(convertColour);
     }