modified: static/js/sensor-2.js
This commit is contained in:
parent
0107a4cef3
commit
da0e2493f3
@ -86,7 +86,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
fetch('http://111.230.197.156:8000/get_sensor_data')
|
fetch('http://111.230.197.156:8000/get_sensor_data')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
var maxDataPoints = window.innerWidth <= 768 ? 50 : 200; // 根据屏幕宽度决定数据量
|
var maxDataPoints = window.innerWidth <= 768 ? 50 : 200;
|
||||||
|
console.log(maxDataPoints);// 根据屏幕宽度决定数据量
|
||||||
timestamps = data.timestamps.slice(-maxDataPoints);
|
timestamps = data.timestamps.slice(-maxDataPoints);
|
||||||
humidities = data.humidities.slice(-maxDataPoints);
|
humidities = data.humidities.slice(-maxDataPoints);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user