This commit is contained in:
2025-09-10 16:51:41 +08:00
parent d0259d12f3
commit 9d0b5abd31
2 changed files with 19 additions and 2 deletions

View File

@@ -48,7 +48,9 @@ class RuYuanZaiYuanModel:
urban_data.append(enroll_data.get("urban", 0) / 10000) # 转换为万人 urban_data.append(enroll_data.get("urban", 0) / 10000) # 转换为万人
town_data.append(enroll_data.get("town", 0) / 10000) # 转换为万人 town_data.append(enroll_data.get("town", 0) / 10000) # 转换为万人
rural_data.append(enroll_data.get("rural", 0) / 10000) # 转换为万人 rural_data.append(enroll_data.get("rural", 0) / 10000) # 转换为万人
total_enroll.append(enroll_data.get("total", 0) / 10000) # 转换为万人 # 计算总和作为总入园数而非使用文件中的total字段
calculated_total = enroll_data.get("urban", 0) + enroll_data.get("town", 0) + enroll_data.get("rural", 0)
total_enroll.append(calculated_total / 10000) # 转换为万人
# 构建ECharts配置 # 构建ECharts配置
option = { option = {
@@ -103,7 +105,22 @@ class RuYuanZaiYuanModel:
"type": "value", "type": "value",
"name": "总入园数", "name": "总入园数",
"min": 0, "min": 0,
"max": 40, "max": "auto",
"interval": "auto", # 自动计算间隔
"position": "right", # 显示在右侧
"axisLabel": {
"formatter": "{value} 万人", # 确保数值格式正确
"color": "#ee6666"
},
"axisLine": {"show": True, "lineStyle": {"color": "#ee6666"}},
"axisTick": {"show": True},
"color": "#333"
},
{
"type": "value",
"name": "总入园数",
"min": 0,
"max": "auto", # 修改为自动适应数据最大值
"interval": 8, "interval": 8,
"axisLabel": { "axisLabel": {
"formatter": "{value} 万人", "formatter": "{value} 万人",