From cb41be79229780fa362c055f4cfe72f2050ca38f Mon Sep 17 00:00:00 2001 From: Pete Richards Date: Wed, 12 Aug 2015 16:27:28 -0700 Subject: [PATCH] Plot uses ColorPalette to allocate colors --- platform/features/plot-reborn/res/templates/mct-plot.html | 2 +- .../features/plot-reborn/src/controllers/PlotController.js | 6 ++++-- platform/features/plot-reborn/src/directives/MCTChart.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/features/plot-reborn/res/templates/mct-plot.html b/platform/features/plot-reborn/res/templates/mct-plot.html index c3b3096f83..3311d70026 100644 --- a/platform/features/plot-reborn/res/templates/mct-plot.html +++ b/platform/features/plot-reborn/res/templates/mct-plot.html @@ -4,7 +4,7 @@ + ng-style="{ 'background-color': series.color.asHexString() }"> {{ series.name }} diff --git a/platform/features/plot-reborn/src/controllers/PlotController.js b/platform/features/plot-reborn/src/controllers/PlotController.js index afdd90e9a4..9b9d613e8a 100644 --- a/platform/features/plot-reborn/src/controllers/PlotController.js +++ b/platform/features/plot-reborn/src/controllers/PlotController.js @@ -1,7 +1,8 @@ /*global define*/ define( - function () { + ['../ColorPalette.js'], + function (ColorPalette) { "use strict"; // TODO: Store this in more accessible locations / retrieve from @@ -13,6 +14,7 @@ define( var isLive = true; var maxDomain = +new Date(); var subscriptions = []; + var palette = new ColorPalette(); var setToDefaultViewport = function() { // TODO: We shouldn't set the viewport until we have received data or something has given us a reasonable viewport. $scope.viewport = { @@ -63,7 +65,7 @@ define( var series = { name: model.name, // TODO: Bring back PlotPalette. - color: [0.12549019607843137, 0.6980392156862745, 0.6666666666666666, 1], + color: palette.getColor(), data: [] }; diff --git a/platform/features/plot-reborn/src/directives/MCTChart.js b/platform/features/plot-reborn/src/directives/MCTChart.js index 4a9ba6b574..ff3206f271 100644 --- a/platform/features/plot-reborn/src/directives/MCTChart.js +++ b/platform/features/plot-reborn/src/directives/MCTChart.js @@ -107,7 +107,7 @@ define( lines.forEach(function(line) { drawAPI.drawLine( line.buffer, - line.color, + line.color.asRGBAArray(), line.pointCount ); });