diff --git a/src/views/graphs.js b/src/views/graphs.js index 9f78e10b5..d82f572e8 100644 --- a/src/views/graphs.js +++ b/src/views/graphs.js @@ -33,6 +33,13 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati return color; } + var colorIndex = 0; + var colors = [ '#2196F3', '#3995b1', '#f0ad4e', '#ff4c4c' ]; + function getNextColor() { + if (colors[colorIndex++]) return colors[colorIndex]; + return getRandomColor(); + } + $scope.setMemoryApp = function (app, color) { $scope.activeApp = app; @@ -144,8 +151,9 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati disk.free = data[0].datapoints[0][0]; disk.occupied = data[2].datapoints[0][0] + data[1].datapoints[0][0]; + colorIndex = 0; disk.contains.forEach(function (content) { - content.color = getRandomColor(); + content.color = getNextColor(); }); // get disk usage data @@ -229,11 +237,12 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati var targets = []; var targetsInfo = []; + colorIndex = 0; $scope.installedApps.forEach(function (app) { targets.push('summarize(collectd.localhost.table-' + app.id + '-memory.gauge-rss, "1min", "avg")'); targetsInfo.push({ label: app.fqdn, - color: getRandomColor(), + color: getNextColor(), app: app }); });