diff --git a/Model/RuYuanZaiYuanCount.py b/Model/RuYuanZaiYuanCount.py index b377cca..325460b 100644 --- a/Model/RuYuanZaiYuanCount.py +++ b/Model/RuYuanZaiYuanCount.py @@ -51,6 +51,10 @@ class RuYuanZaiYuanModel: # 计算总和作为总入园数,而非使用文件中的total字段 calculated_total = enroll_data.get("urban", 0) + enroll_data.get("town", 0) + enroll_data.get("rural", 0) total_enroll.append(calculated_total / 10000) # 转换为万人 + # print(f"{year}年城区入园数: {enroll_data.get('urban', 0)}") + # print(f"{year}年镇区入园数: {enroll_data.get('town', 0)}") + # print(f"{year}年乡村入园数: {enroll_data.get('rural', 0)}") + # print(f"{year}年入园数: {calculated_total}") # 构建ECharts配置 option = { @@ -105,28 +109,17 @@ class RuYuanZaiYuanModel: "type": "value", "name": "总入园数", "min": 0, - "max": "auto", - "interval": "auto", # 自动计算间隔 - "position": "right", # 显示在右侧 + "max": 140, # 增加最大值以留出更多空间 + "interval": 20, + "position": "right", + "nameLocation": "end", # 将名称放在轴末端 + "nameGap": 30, # 增加名称与轴的间距 "axisLabel": { - "formatter": "{value} 万人", # 确保数值格式正确 + "formatter": "{value} 万人", "color": "#ee6666" }, "axisLine": {"show": True, "lineStyle": {"color": "#ee6666"}}, "axisTick": {"show": True}, - "color": "#333" - }, - { - "type": "value", - "name": "总入园数", - "min": 0, - "max": "auto", # 修改为自动适应数据最大值 - "interval": 8, - "axisLabel": { - "formatter": "{value} 万人", - "color": "#333" - }, - "axisLine": {"lineStyle": {"color": "#333"}}, "splitLine": {"show": False} } ], @@ -177,7 +170,7 @@ class RuYuanZaiYuanModel: ], "grid": { "left": "3%", - "right": "4%", + "right": "8%", # 增加右侧边距 "bottom": "3%", "containLabel": True } diff --git a/Model/__pycache__/RuYuanZaiYuanCount.cpython-310.pyc b/Model/__pycache__/RuYuanZaiYuanCount.cpython-310.pyc index 31e6b2a..38cf5da 100644 Binary files a/Model/__pycache__/RuYuanZaiYuanCount.cpython-310.pyc and b/Model/__pycache__/RuYuanZaiYuanCount.cpython-310.pyc differ diff --git a/Start.py b/Start.py index d1b05ce..441ccbf 100644 --- a/Start.py +++ b/Start.py @@ -16,5 +16,5 @@ app.include_router(bigscreen_router) # 主程序入口 if __name__ == "__main__": - # 启动 FastAPI 应用,监听 8100 端口 - uvicorn.run(app, host="0.0.0.0", port=8100) \ No newline at end of file + # 启动 FastAPI 应用,监听 8200 端口 + uvicorn.run(app, host="0.0.0.0", port=8200) \ No newline at end of file