Browse Source

feat: update color of hazarded stations in DataV line map for chart consistency

Signed-off-by: Carlos <568187512@qq.com>
Carlos 5 days ago
parent
commit
00c2243467

+ 3 - 2
src/app/classes/d3/line.class.ts

@@ -1,7 +1,8 @@
 import { ElementRef, inject } from '@angular/core';
 import * as d3 from 'd3';
 import { Subject } from 'rxjs';
-import { hazardLevelColor, hazardLevels } from '../../pages/manager/hazard/hazard.utils';
+import { datavHazardLevelColor } from '../../pages/datav/datav.utils';
+import { hazardLevels } from '../../pages/manager/hazard/hazard.utils';
 import { Svg, SvgGroup } from './d3.utils';
 import { Station, StationD3Model } from './station.class';
 
@@ -48,7 +49,7 @@ export class LineD3Model {
   getHighlightColor(ids: number[], troubleList: Hazard.HazardDto[]) {
     const targetHazards = troubleList.filter(item => ids.includes(item.id));
     const highestLevel = hazardLevels.find(level => targetHazards.every(item => item.level === level));
-    return highestLevel ? hazardLevelColor[highestLevel] : undefined;
+    return highestLevel ? datavHazardLevelColor[highestLevel] : undefined;
   }
   initializeSvg() {
     // 创建 SVG 容器

+ 6 - 0
src/app/pages/datav/datav.utils.ts

@@ -0,0 +1,6 @@
+export const datavHazardLevelColor: Record<string, string> = {
+  '重大': '#FE6257',
+  'A': '#24D3AC',
+  B: '#F7C335',
+  C: '#327DFE',
+};

+ 3 - 2
src/app/pages/datav/digital-line/main-metro/main-metro.component.ts

@@ -2,7 +2,8 @@ import { Component, ElementRef, Input, ViewChild } from '@angular/core';
 import { StationEvent } from '../../../../classes/d3/line.class';
 import { StationD3Model } from '../../../../classes/d3/station.class';
 import { horizontalInOutReverse } from '../../../../common.animation';
-import { hazardLevelColor, hazardLevelOptions } from '../../../manager/hazard/hazard.utils';
+import { hazardLevelOptions } from '../../../manager/hazard/hazard.utils';
+import { datavHazardLevelColor } from '../../datav.utils';
 import { CommonNzModule } from './../../../../common.nz.module';
 import { KnowledgeService } from './../../../../services/knowledge.service';
 import { LineAirportComponent } from './../../../../shared/line/airport/airport.component';
@@ -55,7 +56,7 @@ export class MainMetroComponent {
     this.hazardLevels = hazardLevelOptions.map(option => ({
       label: option.label + '隐患',
       value: this.currentHazardItems.filter(item => item.level === option.value).length,
-      color: hazardLevelColor[option.value],
+      color: datavHazardLevelColor[option.value],
       key: option.value,
       checked: true,
     }));