From 66090d06a87ff940fd5fc138d7260c755a5a3127 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 14 二月 2025 17:26:27 +0800
Subject: [PATCH] 新增数据平面展示方式

---
 src/model/Legend.js |   39 +++++++++++++++++++++++++++++++++++----
 1 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/model/Legend.js b/src/model/Legend.js
index 304934e..42abee3 100644
--- a/src/model/Legend.js
+++ b/src/model/Legend.js
@@ -8,6 +8,7 @@
 
   //鍚勭洃娴嬪洜瀛愭暟鎹垎绾э紙鏍囧噯锛�
   _legend_r: {
+    NO: [0, 100, 200, 700, 1200, 2340],
     NO2: [0, 100, 200, 700, 1200, 2340],
     CO: [0, 5, 10, 35, 60, 90],
     H2S: [0, 150, 500, 650, 800, 1600],
@@ -25,6 +26,14 @@
 
   //鍚勭洃娴嬪洜瀛愭暟鎹垎绾э紙鏍囧噯锛夊搴旈鑹�
   _legend_c: {
+    NO: [
+      [0, 0.89, 0, 0.75],
+      [1, 1, 0, 0.75],
+      [1, 0.49, 0, 0.75],
+      [1, 0, 0, 0.75],
+      [0.6, 0, 0.3, 0.75],
+      [0.49, 0, 0.14, 0.75]
+    ],
     NO2: [
       [0, 0.89, 0, 0.75],
       [1, 1, 0, 0.75],
@@ -172,23 +181,45 @@
   },
 
   /**
+   * 鑾峰彇褰撳墠棰滆壊涓婁竴涓瓑绾х殑棰滆壊
+   * @param {*} name
+   * @param {*} type
+   * @param {*} color
+   */
+  getPreviousColor(name, type, color) {
+    let colors;
+    if (type == this.S_TYPE) {
+      colors = this._legend_c[name];
+    } else {
+      colors = this._custom;
+    }
+    if (colors == undefined) {
+      colors = this._legend_c['PM25'];
+    }
+    let index = colors.indexOf(color);
+    index--;
+    if (index < 0) index = 0;
+    return colors[index];
+  },
+
+  /**
    * 鑾峰彇鐩戞祴鍥犲瓙褰撳墠娴撳害瀵瑰簲鐨勯鑹�
    * @param name 鐩戞祴鍥犲瓙鍚嶇О
    * @param data 鐩戞祴鍥犲瓙娴撳害
    */
   getStandardColor: function (name, data) {
-    var range = this._legend_r[name];
-    var colors = this._legend_c[name];
+    let range = this._legend_r[name];
+    let colors = this._legend_c[name];
     if (range == undefined) {
       range = this._legend_r['PM25'];
       colors = this._legend_c['PM25'];
     }
     // return colors[0]
 
-    var selected = undefined;
+    let selected = undefined;
     for (let i = 0; i < range.length; i++) {
       const d = range[i];
-      var d1 = d;
+      let d1 = d;
       if (name == 'CO') {
         d1 *= 1000;
       }

--
Gitblit v1.9.3