X-Git-Url: http://repos.xcallymotion.com/?a=blobdiff_plain;f=public%2Fbower_components%2Fangular-chart.js%2Fangular-chart.js;h=c28f2678d648eeaf47692560cea022274f125150;hb=5a1e44ae9524fee72c7a05367a706d12dad9ac33;hp=83750817c56cb60eb92b37054f69f12f6e2a5163;hpb=1371e9b959804ff80d0f8f55a380d796dde33352;p=motion.git diff --git a/public/bower_components/angular-chart.js/angular-chart.js b/public/bower_components/angular-chart.js/angular-chart.js index 8375081..c28f267 100644 --- a/public/bower_components/angular-chart.js/angular-chart.js +++ b/public/bower_components/angular-chart.js/angular-chart.js @@ -2,7 +2,9 @@ 'use strict'; if (typeof exports === 'object') { // Node/CommonJS - module.exports = factory(typeof angular ? angular : require('angular'), require('chart.js')); + module.exports = factory( + typeof angular !== 'undefined' ? angular : require('angular'), + typeof Chart !== 'undefined' ? Chart : require('chart.js')); } else if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['angular', 'chart'], factory); @@ -184,11 +186,11 @@ } if (! scope.data || ! scope.data.length) return; scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour; - scope.colours = getColours(type, scope); + var 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 || [], scope.colours) : - getData(scope.labels, scope.data, scope.colours); + getDataSets(scope.labels, scope.data, scope.series || [], colours) : + getData(scope.labels, scope.data, colours); var options = angular.extend({}, ChartJs.getOptions(type), scope.options); chart = new ChartJs.Chart(ctx)[type](data, options); scope.$emit('create', chart); @@ -243,13 +245,18 @@ } 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); }