This commit is contained in:
2025-09-11 14:07:47 +08:00
parent 743cbd9492
commit 40a7a8fb7a
3 changed files with 9 additions and 17 deletions

View File

@@ -93,7 +93,7 @@ class RuYuanZaiYuanModel:
"borderWidth": 1 "borderWidth": 1
}, },
"legend": { "legend": {
"data": ["城区", "镇区", "乡村", "总入园数", "2022年基数(万人)"], "data": ["城区", "镇区", "乡村", "总入园数", "2022年基数"],
"top": 0, "top": 0,
"textStyle": {"color": "#fff"}, "textStyle": {"color": "#fff"},
"icon": "roundRect", "icon": "roundRect",
@@ -104,7 +104,7 @@ class RuYuanZaiYuanModel:
{ {
"type": "category", "type": "category",
"data": years, "data": years,
"axisPointer": {type: "shadow"}, "axisPointer": {"type": "shadow"},
"axisLine": {"lineStyle": {"color": "#fff"}}, "axisLine": {"lineStyle": {"color": "#fff"}},
"axisLabel": {"color": "#fff"}, "axisLabel": {"color": "#fff"},
"nameTextStyle": {"color": "#fff"} "nameTextStyle": {"color": "#fff"}
@@ -113,9 +113,7 @@ class RuYuanZaiYuanModel:
"yAxis": [ "yAxis": [
{ {
"type": "value", "type": "value",
"min": 0,
"max": 25,
"interval": 5,
"axisLabel": { "axisLabel": {
"formatter": "{value}" "formatter": "{value}"
, "color": "#fff" , "color": "#fff"
@@ -123,9 +121,7 @@ class RuYuanZaiYuanModel:
}, },
{ {
"type": "value", "type": "value",
"min": 0,
"max": 25,
"interval": 5,
"axisLabel": {"formatter": "{value}", "color": "#fff"}, "axisLabel": {"formatter": "{value}", "color": "#fff"},
}, },
@@ -134,7 +130,6 @@ class RuYuanZaiYuanModel:
{ {
"name": "城区", "name": "城区",
"type": "bar", "type": "bar",
"tooltip": "{valueFormatter: (v) = > v 万人}",
"data": urban_data, "data": urban_data,
"itemStyle": { "itemStyle": {
"borderRadius": [6, 6, 0, 0], "borderRadius": [6, 6, 0, 0],
@@ -144,7 +139,6 @@ class RuYuanZaiYuanModel:
"name": "镇区", "name": "镇区",
"type": "bar", "type": "bar",
"data": town_data, "data": town_data,
"tooltip": "{valueFormatter: (v) = > v 万人}",
"itemStyle": { "itemStyle": {
"borderRadius": [6, 6, 0, 0], "borderRadius": [6, 6, 0, 0],
}, },
@@ -153,7 +147,6 @@ class RuYuanZaiYuanModel:
"name": "乡村", "name": "乡村",
"type": "bar", "type": "bar",
"data": rural_data, "data": rural_data,
"tooltip": "{valueFormatter: (v) = > v 万人}",
"itemStyle": { "itemStyle": {
"borderRadius": [6, 6, 0, 0] "borderRadius": [6, 6, 0, 0]
}, },
@@ -162,17 +155,14 @@ class RuYuanZaiYuanModel:
"name": "总入园数", "name": "总入园数",
"type": "line", "type": "line",
"yAxisIndex": 1, "yAxisIndex": 1,
"data": total_enroll, "data": total_enroll
"tooltip": "{valueFormatter: (v) = > v 万人}",
}, },
# 添加2022年基数的粉色折线 # 添加2022年基数的粉色折线
{ {
"name": "2022年基数(万人)", "name": "2022年基数",
"type": "line", "type": "line",
"yAxisIndex": 1, "yAxisIndex": 1,
"data": base_2022_line, "data": base_2022_line
"lineStyle": {"color": "#ff9e9e", "width": 2, "type": "solid"},
"tooltip": "{valueFormatter: (v) = > v 万人}",
} }
] ]
} }

View File

@@ -60,6 +60,8 @@ $(function () {
seriesItem.tooltip = { valueFormatter: (v) => v + " 万人" }; seriesItem.tooltip = { valueFormatter: (v) => v + " 万人" };
}); });
myChart.setOption(option); myChart.setOption(option);
window.addEventListener("resize", function () { window.addEventListener("resize", function () {
myChart.resize(); myChart.resize();