[Plot] Use ColorService for plot colors

This commit is contained in:
Pete Richards
2015-08-13 16:07:08 -07:00
parent 48f345a46b
commit a0dc3da8fb
2 changed files with 7 additions and 7 deletions

View File

@ -53,12 +53,12 @@
{ {
"key": "PlotController", "key": "PlotController",
"implementation": "controllers/PlotController.js", "implementation": "controllers/PlotController.js",
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler" ] "depends": [ "$scope", "colorService"]
}, },
{ {
"key": "StackedPlotController", "key": "StackedPlotController",
"implementation": "controllers/StackedPlotController.js", "implementation": "controllers/StackedPlotController.js",
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler" ] "depends": [ "$scope" ]
} }
], ],
"types": [ "types": [

View File

@ -1,20 +1,20 @@
/*global define*/ /*global define*/
define( define(
['../ColorPalette.js'], [],
function (ColorPalette) { function () {
"use strict"; "use strict";
// TODO: Store this in more accessible locations / retrieve from // TODO: Store this in more accessible locations / retrieve from
// domainObject metadata. // domainObject metadata.
var DOMAIN_INTERVAL = 1 * 60 * 1000; // One minute. var DOMAIN_INTERVAL = 1 * 60 * 1000; // One minute.
function PlotController($scope) { function PlotController($scope, colorService) {
var plotHistory = []; var plotHistory = [];
var isLive = true; var isLive = true;
var maxDomain = +new Date(); var maxDomain = +new Date();
var subscriptions = []; var subscriptions = [];
var palette = new ColorPalette(); var palette = new colorService.ColorPalette();
var setToDefaultViewport = function() { var setToDefaultViewport = function() {
// TODO: We shouldn't set the viewport until we have received data or something has given us a reasonable viewport. // TODO: We shouldn't set the viewport until we have received data or something has given us a reasonable viewport.
$scope.viewport = { $scope.viewport = {
@ -65,7 +65,7 @@ define(
var series = { var series = {
name: model.name, name: model.name,
// TODO: Bring back PlotPalette. // TODO: Bring back PlotPalette.
color: palette.getColor(), color: palette.getColor($scope.series.length),
data: [] data: []
}; };