From de6fd089b37613808e5a3bef38ecc0761f7456e0 Mon Sep 17 00:00:00 2001 From: Riku <risaku@163.com> Date: 星期日, 02 三月 2025 22:07:47 +0800 Subject: [PATCH] AOD数据产品 --- src/model/Legend.js | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/src/model/Legend.js b/src/model/Legend.js index 5021b16..9d852d1 100644 --- a/src/model/Legend.js +++ b/src/model/Legend.js @@ -148,7 +148,7 @@ [0.87, 0.92, 0.03, 0.75], [0.8, 0.67, 0.04, 0.75], [0.92, 0.28, 0.07, 0.75], - [0.6, 0.05, 0.05, 0.75] + [0.96, 0.05, 0.05, 0.75] ], getStandardRange: function (name) { @@ -297,6 +297,35 @@ i = this._custom.length - 1; } return this._custom[i]; + }, + + getCustomColorAndNext: function (data, min, max) { + if (!data) { + return { + color: [0, 0, 0, 0], + nextColor: [0, 0, 0, 0], + range: 0, + nextRange: 0 + }; + } + + // 灏嗘暟鎹寜鐓ч鑹叉暟閲忓垎闅旓紝姹傚嚭姣忎竴娈电殑鏁版嵁鍋忕Щ閲� + var per = (max - min) / (this._custom.length - 1); + // 璁$畻褰撳墠鏁版嵁鎵�鍦ㄧ殑鍒嗘鑼冨洿 + var i = parseInt((data - min) / per); + // 濡傛灉鏄渶澶у�硷紝鍚屾牱鍒嗗壊鍒版渶鍚庝竴娈� + if (i == this._custom.length - 1) i--; + var range = min + i * per; + + let nextIndex = i + 1; + let nextRange = min + nextIndex * per; + + return { + color: this._custom[i], + nextColor: this._custom[nextIndex], + range, + nextRange + }; } }; -- Gitblit v1.9.3