@ -37,11 +37,8 @@ export class AnalyticController {
private _savingNewAnalyticUnit : boolean = false ;
private _savingNewAnalyticUnit : boolean = false ;
private _tempIdCounted : number = - 1 ;
private _tempIdCounted : number = - 1 ;
private _graphLocked : boolean = false ;
private _graphLocked : boolean = false ;
private _currentColorIndex : number = 0 ;
private _statusRunners : Set < AnalyticUnitId > = new Set < AnalyticUnitId > ( ) ;
private _statusRunners : Set < AnalyticUnitId > = new Set < AnalyticUnitId > ( ) ;
constructor ( private _panelObject : any , private _analyticService : AnalyticService , private _emitter : Emitter ) {
constructor ( private _panelObject : any , private _analyticService : AnalyticService , private _emitter : Emitter ) {
if ( _panelObject . anomalyTypes === undefined ) {
if ( _panelObject . anomalyTypes === undefined ) {
_panelObject . anomalyTypes = [ ] ;
_panelObject . anomalyTypes = [ ] ;
@ -50,7 +47,6 @@ export class AnalyticController {
this . _labelingDataDeletedSegments = new SegmentArray < AnalyticSegment > ( ) ;
this . _labelingDataDeletedSegments = new SegmentArray < AnalyticSegment > ( ) ;
this . _analyticUnitsSet = new AnalyticUnitsSet ( this . _panelObject . anomalyTypes ) ;
this . _analyticUnitsSet = new AnalyticUnitsSet ( this . _panelObject . anomalyTypes ) ;
this . analyticUnits . forEach ( a = > this . runEnabledWaiter ( a ) ) ;
this . analyticUnits . forEach ( a = > this . runEnabledWaiter ( a ) ) ;
this . _currentColorIndex = this . _panelObject . anomalyTypes . length % ANALYTIC_UNIT_COLORS . length ;
}
}
getSegmentsSearcher ( ) : AnalyticSegmentsSearcher {
getSegmentsSearcher ( ) : AnalyticSegmentsSearcher {
@ -72,9 +68,13 @@ export class AnalyticController {
this . _newAnalyticUnit = new AnalyticUnit ( ) ;
this . _newAnalyticUnit = new AnalyticUnit ( ) ;
this . _creatingNewAnalyticType = true ;
this . _creatingNewAnalyticType = true ;
this . _savingNewAnalyticUnit = false ;
this . _savingNewAnalyticUnit = false ;
this . _newAnalyticUnit . color = ANALYTIC_UNIT_COLORS [ this . _currentColorIndex ] ;
if ( this . analyticUnits . length === 0 ) {
this . _currentColorIndex ++ ;
this . _newAnalyticUnit . color = ANALYTIC_UNIT_COLORS [ 0 ] ;
this . _currentColorIndex %= ANALYTIC_UNIT_COLORS . length ;
} else {
let colorIndex = ANALYTIC_UNIT_COLORS . indexOf ( _ . last ( this . analyticUnits ) . color ) + 1 ;
colorIndex %= ANALYTIC_UNIT_COLORS . length ;
this . _newAnalyticUnit . color = ANALYTIC_UNIT_COLORS [ colorIndex ] ;
}
}
}
async saveNew ( metricExpanded : MetricExpanded , datasourceRequest : DatasourceRequest , panelId : number ) {
async saveNew ( metricExpanded : MetricExpanded , datasourceRequest : DatasourceRequest , panelId : number ) {