'commit'
This commit is contained in:
@@ -51,6 +51,10 @@ class RuYuanZaiYuanModel:
|
|||||||
# 计算总和作为总入园数,而非使用文件中的total字段
|
# 计算总和作为总入园数,而非使用文件中的total字段
|
||||||
calculated_total = enroll_data.get("urban", 0) + enroll_data.get("town", 0) + enroll_data.get("rural", 0)
|
calculated_total = enroll_data.get("urban", 0) + enroll_data.get("town", 0) + enroll_data.get("rural", 0)
|
||||||
total_enroll.append(calculated_total / 10000) # 转换为万人
|
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配置
|
# 构建ECharts配置
|
||||||
option = {
|
option = {
|
||||||
@@ -105,28 +109,17 @@ class RuYuanZaiYuanModel:
|
|||||||
"type": "value",
|
"type": "value",
|
||||||
"name": "总入园数",
|
"name": "总入园数",
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": "auto",
|
"max": 140, # 增加最大值以留出更多空间
|
||||||
"interval": "auto", # 自动计算间隔
|
"interval": 20,
|
||||||
"position": "right", # 显示在右侧
|
"position": "right",
|
||||||
|
"nameLocation": "end", # 将名称放在轴末端
|
||||||
|
"nameGap": 30, # 增加名称与轴的间距
|
||||||
"axisLabel": {
|
"axisLabel": {
|
||||||
"formatter": "{value} 万人", # 确保数值格式正确
|
"formatter": "{value} 万人",
|
||||||
"color": "#ee6666"
|
"color": "#ee6666"
|
||||||
},
|
},
|
||||||
"axisLine": {"show": True, "lineStyle": {"color": "#ee6666"}},
|
"axisLine": {"show": True, "lineStyle": {"color": "#ee6666"}},
|
||||||
"axisTick": {"show": True},
|
"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}
|
"splitLine": {"show": False}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -177,7 +170,7 @@ class RuYuanZaiYuanModel:
|
|||||||
],
|
],
|
||||||
"grid": {
|
"grid": {
|
||||||
"left": "3%",
|
"left": "3%",
|
||||||
"right": "4%",
|
"right": "8%", # 增加右侧边距
|
||||||
"bottom": "3%",
|
"bottom": "3%",
|
||||||
"containLabel": True
|
"containLabel": True
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user