diff --git a/ruoyi-admin/src/main/resources/templates/system/ArrayTemperatureData/ArrayTemperatureData.html b/ruoyi-admin/src/main/resources/templates/system/ArrayTemperatureData/ArrayTemperatureData.html
index 28d158b..092d672 100644
--- a/ruoyi-admin/src/main/resources/templates/system/ArrayTemperatureData/ArrayTemperatureData.html
+++ b/ruoyi-admin/src/main/resources/templates/system/ArrayTemperatureData/ArrayTemperatureData.html
@@ -28,12 +28,12 @@
let getColorByTemperature = {}
- function getGradientColor(level) {
+ function getGradientColor(level,sum) {
// 确保级别在1到50之间
- level = Math.max(1, Math.min(50, level));
+ level = Math.max(1, Math.min(sum, level));
// 将级别映射到0到1之间的色相值
- const hue = (0.6 - (0.6 / 50) * level) % 1; // 0.6是红色的色相值
+ const hue = (0.6 - (0.6 / sum) * level) % 1; // 0.6是红色的色相值
const saturation = 1; // 饱和度最大
const value = 1; // 亮度最大
@@ -69,15 +69,23 @@
return `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;
}
- for (var i = 0; i <= 10; i++) {
- getColorByTemperature[20+i] = getGradientColor(i)
- }
const getData = () =>{
$.post(prefix+'/newDataStreak',(e)=>{
- console.log(e)
$('#temInfo').html(`最高温度:${e.rows[0].maxTemperature}℃ 最低温度:${e.rows[0].minTemperature}℃ 平均温度:${e.rows[0].avgTemperature}℃`)
$('#timeInfo').html(`采集时间:${e.rows[0].collectTime} `)
let colors = []
+ let tems = []
+ for(i in e.rows[0]){
+ if(i.includes('site')){
+ tems.push(e.rows[0][i])
+ }
+ }
+ let sum = Math.max(...tems) - Math.min(...tems)
+ getColorByTemperature={}
+
+ for (var i = 0; i <= sum; i++) {
+ getColorByTemperature[20+i] = getGradientColor(i,sum)
+ }
for(i in e.rows[0]){
if(i.includes('site')){
colors.push(getColorByTemperature[e.rows[0][i]])
@@ -109,7 +117,7 @@
})
}
getData()
- setInterval(getData,1000*60)
+ setInterval(getData,1000*2)
})