1- import { crc32 } from '../lib/pseudo-crc32.js'
2- import { hslToRgb } from '../lib/color-conversion.js'
31import moment from 'moment'
42import store from './store/'
53
@@ -209,7 +207,7 @@ export class DataCache {
209207 return units
210208 }
211209
212- initializeCacheWithColor ( metricName , newColor ) {
210+ initializeCache ( metricName ) {
213211 const newCache = this . assureMetricExists ( metricName )
214212 Object . keys ( newCache . series ) . forEach ( ( aggregate ) => { this . newSeries ( metricName , aggregate ) } )
215213 if ( ! newCache . band ) {
@@ -218,18 +216,13 @@ export class DataCache {
218216 const toUpdate = [ newCache . band ]
219217 Object . keys ( newCache . series ) . forEach ( ( aggregate ) => { toUpdate . push ( newCache . series [ aggregate ] ) } )
220218
221- toUpdate . forEach ( ( val ) => {
222- val . styleOptions . color = newColor
223- } )
224-
225219 return newCache
226220 }
227221}
228222
229223class MetricCache {
230224 constructor ( paramMetricQReference , paramMetricName ) {
231225 this . name = paramMetricName
232- this . color = determineColorForMetric ( paramMetricName )
233226 this . series = {
234227 min : undefined ,
235228 max : undefined ,
@@ -340,29 +333,11 @@ class MetricCache {
340333 }
341334
342335 defaultBandStyling ( ) {
343- const options = matchStylingOptions ( 'band' )
344- if ( options . color === 'default' ) {
345- options . color = this . color
346- }
347- return options
336+ return matchStylingOptions ( 'band' )
348337 }
349338
350339 defaultSeriesStyling ( aggregateName ) {
351- const options = matchStylingOptions ( aggregateName )
352- if ( options . color === 'default' ) {
353- options . color = this . color
354- }
355- return options
356- }
357-
358- updateColor ( color ) {
359- this . color = color
360- this . band . styleOptions . color = color
361- for ( const key in this . series ) {
362- if ( this . series [ key ] ) {
363- this . series [ key ] . styleOptions . color = color
364- }
365- }
340+ return matchStylingOptions ( aggregateName )
366341 }
367342}
368343
@@ -577,7 +552,6 @@ class Point {
577552 constructor ( paramTime , paramValue ) {
578553 this . time = paramTime
579554 this . value = paramValue
580- this . count = undefined
581555 }
582556
583557 clone ( ) {
@@ -589,7 +563,6 @@ const stylingOptions = {
589563 avg : {
590564 title : 'AVG Series' ,
591565 skip : false ,
592- color : 'default' ,
593566 connect : 'next' ,
594567 width : 8 ,
595568 lineWidth : 2 ,
@@ -599,7 +572,6 @@ const stylingOptions = {
599572 min : {
600573 title : 'Min Series' ,
601574 skip : true ,
602- color : 'default' ,
603575 connect : 'next' ,
604576 width : 2 ,
605577 lineWidth : 2 ,
@@ -609,7 +581,6 @@ const stylingOptions = {
609581 max : {
610582 title : 'Max Series' ,
611583 skip : true ,
612- color : 'default' ,
613584 connect : 'next' ,
614585 width : 2 ,
615586 lineWidth : 2 ,
@@ -619,7 +590,6 @@ const stylingOptions = {
619590 raw : {
620591 title : 'Raw Series' ,
621592 skip : false ,
622- color : 'default' ,
623593 connect : 'none' ,
624594 width : 8 ,
625595 dots : true
@@ -628,7 +598,6 @@ const stylingOptions = {
628598 title : 'All Bands' ,
629599 skip : false ,
630600 connect : 'next' ,
631- color : 'default' ,
632601 alpha : 0.3
633602 }
634603}
@@ -639,8 +608,3 @@ function matchStylingOptions (styleType) {
639608 }
640609 return JSON . parse ( JSON . stringify ( stylingOptions [ styleType ] ) )
641610}
642-
643- function determineColorForMetric ( metricBaseName ) {
644- const rgb = hslToRgb ( ( crc32 ( metricBaseName ) >> 24 & 255 ) / 255.00 , 1 , 0.46 )
645- return 'rgb(' + rgb [ 0 ] + ',' + rgb [ 1 ] + ',' + rgb [ 2 ] + ')'
646- }
0 commit comments