生成图片

master
夜笙歌 7 months ago
parent 7757747c91
commit 794cff1fcc

@ -7,6 +7,7 @@
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
<div class="centerDiv"> <div class="centerDiv">
<div id="temInfo" style="text-align: center;white-space: nowrap"></div>
<div id="canvasDiv" style="width: 320px;height:240px;margin:0 auto;"> <div id="canvasDiv" style="width: 320px;height:240px;margin:0 auto;">
<canvas id="canvas"></canvas> <canvas id="canvas"></canvas>
</div> </div>
@ -71,10 +72,11 @@
getColorByTemperature[20+i] = getGradientColor(i) getColorByTemperature[20+i] = getGradientColor(i)
} }
$.post(prefix+'/newDataStreak',(e)=>{ $.post(prefix+'/newDataStreak',(e)=>{
console.log(e)
$('#temInfo').html(`<span style="color:#ff0000">最高温度:${e.rows[0].maxTemperature}℃</span> <span style="color:#0b05f7">最低温度:${e.rows[0].minTemperature}℃</span> <span style="color:#0066e4">平均温度:${e.rows[0].avgTemperature}℃</span>`)
let colors = [] let colors = []
for(i in e.rows[0]){ for(i in e.rows[0]){
if(i.includes('site')){ if(i.includes('site')){
console.log(getColorByTemperature[e.rows[0][i]])
colors.push(getColorByTemperature[e.rows[0][i]]) colors.push(getColorByTemperature[e.rows[0][i]])
} }
} }

Loading…
Cancel
Save