feat: implement interactive weather map application with city markers, detail panel, and temperature forecast chart.
This commit is contained in:
@@ -586,6 +586,7 @@ async def city_history(name: str):
|
||||
act = rec.get("actual_high")
|
||||
deb = rec.get("deb_prediction")
|
||||
mu = rec.get("mu")
|
||||
mgm = rec.get("forecasts", {}).get("MGM")
|
||||
|
||||
# Only return items where we have at least an actual or a prediction
|
||||
out.append({
|
||||
@@ -593,6 +594,7 @@ async def city_history(name: str):
|
||||
"actual": float(act) if act is not None else None,
|
||||
"deb": float(deb) if deb is not None else None,
|
||||
"mu": float(mu) if mu is not None else None,
|
||||
"mgm": float(mgm) if mgm is not None else None,
|
||||
})
|
||||
return {"history": out}
|
||||
|
||||
|
||||
@@ -1167,12 +1167,14 @@ async function openHistoryModal() {
|
||||
const actuals = [];
|
||||
const debs = [];
|
||||
const mus = [];
|
||||
const mgms = [];
|
||||
|
||||
data.forEach((row) => {
|
||||
dates.push(row.date);
|
||||
actuals.push(row.actual);
|
||||
debs.push(row.deb);
|
||||
mus.push(row.mu);
|
||||
mgms.push(row.mgm);
|
||||
|
||||
if (row.actual != null && row.deb != null) {
|
||||
debErrors.push(Math.abs(row.actual - row.deb));
|
||||
@@ -1242,6 +1244,16 @@ async function openHistoryModal() {
|
||||
tension: 0.2,
|
||||
pointRadius: 3,
|
||||
},
|
||||
{
|
||||
label: "MGM 官方预报",
|
||||
data: mgms,
|
||||
borderColor: "#fb923c", // orange
|
||||
backgroundColor: "transparent",
|
||||
borderWidth: 2,
|
||||
tension: 0.2,
|
||||
pointRadius: 3,
|
||||
hidden: false, // Show by default for Ankara
|
||||
},
|
||||
],
|
||||
},
|
||||
options: {
|
||||
|
||||
Reference in New Issue
Block a user