新增实时滚动温度走势图:API端点+前端组件

后端 city_realtime_stream.py:循环缓冲区(deque maxlen=1440),best_temp() METAR优先。路由 /api/city/{name}/realtime-stream 返回 {points, thresholds}。前端 RealtimeScrollChart:每30秒轮询,一条温度线+多条阈值横线,横轴随时间推进。
This commit is contained in:
2569718930@qq.com
2026-05-25 06:43:42 +08:00
parent 414708794d
commit 9978ac3e01
4 changed files with 299 additions and 3 deletions
+8
View File
@@ -11,6 +11,7 @@ from web.services.city_api import (
get_city_summary_payload,
list_cities_payload,
)
from web.services.city_realtime_stream import get_realtime_stream_payload
router = APIRouter(tags=["city"])
@@ -208,3 +209,10 @@ async def city_holders(
"available": True,
"condition_id": condition_id,
}
@router.get("/api/city/{name}/realtime-stream")
async def city_realtime_stream(name: str):
"""Return a rolling window of recent temperature readings + market
threshold lines for the scrolling realtime chart."""
return get_realtime_stream_payload(name)