Plot uses ColorPalette to allocate colors

This commit is contained in:
Pete Richards 2015-08-12 16:27:28 -07:00
parent 52b8720d37
commit cb41be7922
3 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<span class="plot-legend-item" <span class="plot-legend-item"
ng-repeat="series in series"> ng-repeat="series in series">
<span class="plot-color-swatch" <span class="plot-color-swatch"
ng-style="{ 'background-color': series.color }"> ng-style="{ 'background-color': series.color.asHexString() }">
</span> </span>
<span class="title-label">{{ series.name }}</span> <span class="title-label">{{ series.name }}</span>
</span> </span>

View File

@ -1,7 +1,8 @@
/*global define*/ /*global define*/
define( define(
function () { ['../ColorPalette.js'],
function (ColorPalette) {
"use strict"; "use strict";
// TODO: Store this in more accessible locations / retrieve from // TODO: Store this in more accessible locations / retrieve from
@ -13,6 +14,7 @@ define(
var isLive = true; var isLive = true;
var maxDomain = +new Date(); var maxDomain = +new Date();
var subscriptions = []; var subscriptions = [];
var palette = new 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 = {
@ -63,7 +65,7 @@ define(
var series = { var series = {
name: model.name, name: model.name,
// TODO: Bring back PlotPalette. // TODO: Bring back PlotPalette.
color: [0.12549019607843137, 0.6980392156862745, 0.6666666666666666, 1], color: palette.getColor(),
data: [] data: []
}; };

View File

@ -107,7 +107,7 @@ define(
lines.forEach(function(line) { lines.forEach(function(line) {
drawAPI.drawLine( drawAPI.drawLine(
line.buffer, line.buffer,
line.color, line.color.asRGBAArray(),
line.pointCount line.pointCount
); );
}); });