'commit'
This commit is contained in:
BIN
Config/__pycache__/Config.cpython-312.pyc
Normal file
BIN
Config/__pycache__/Config.cpython-312.pyc
Normal file
Binary file not shown.
BIN
Config/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
Config/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
Controller/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
Controller/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
@@ -54,6 +54,7 @@ class RuYuanZaiYuanModel:
|
||||
# calculated_total = enroll_data.get("urban", 0) + enroll_data.get("town", 0) + enroll_data.get("rural", 0)
|
||||
# total_enroll.append(calculated_total / 10000) # 转换为万人
|
||||
|
||||
<<<<<<< HEAD
|
||||
xAxis = ["2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026"]
|
||||
series_data_1 = [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6]
|
||||
series_data_2 = [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6]
|
||||
@@ -68,6 +69,145 @@ class RuYuanZaiYuanModel:
|
||||
"line_data": line_data
|
||||
}
|
||||
return data
|
||||
=======
|
||||
# 提取云南省级数据
|
||||
yunnan_enroll = next((item for item in enrollment_data if item["area_name"] == "云南省"), None)
|
||||
|
||||
if not yunnan_enroll:
|
||||
return {}
|
||||
|
||||
# 提取年份数据(2015-2024)
|
||||
years = [str(year) for year in range(2015, 2025)]
|
||||
|
||||
# 构建学前教育数据
|
||||
urban_data = [] # 城区数据
|
||||
town_data = [] # 镇区数据
|
||||
rural_data = [] # 乡村数据
|
||||
total_enroll = [] # 总入园数
|
||||
|
||||
for year in years:
|
||||
enroll_data = yunnan_enroll["education_data"]["preschool"].get(year, {})
|
||||
urban_data.append(enroll_data.get("urban", 0) / 10000) # 转换为万人
|
||||
town_data.append(enroll_data.get("town", 0) / 10000) # 转换为万人
|
||||
rural_data.append(enroll_data.get("rural", 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) # 转换为万人
|
||||
|
||||
# 添加2022年基数的粉色折线
|
||||
base_year = "2022"
|
||||
# 找到2022年在years中的索引位置
|
||||
base_index = years.index(base_year) if base_year in years else 0
|
||||
# 获取2022年的总入园数作为基数
|
||||
base_value = total_enroll[base_index] if base_index < len(total_enroll) else 0
|
||||
# 创建2022年基数折线数据(2022-2024年)
|
||||
base_2022_line = []
|
||||
for i, year in enumerate(years):
|
||||
# 只在2022年及之后显示基数线
|
||||
if i >= base_index:
|
||||
base_2022_line.append(base_value)
|
||||
else:
|
||||
base_2022_line.append(None) # 2022年之前不显示
|
||||
|
||||
# 构建ECharts配置
|
||||
option = {
|
||||
"grid": {
|
||||
"left": 0,
|
||||
"right": 0,
|
||||
"top": 40,
|
||||
"bottom": 10,
|
||||
"containLabel": True,
|
||||
},
|
||||
"textStyle": {
|
||||
"color": "#fff",
|
||||
},
|
||||
"tooltip": {
|
||||
"trigger": "axis",
|
||||
"axisPointer": {
|
||||
"type": "cross",
|
||||
"crossStyle": {"color": "#999"}
|
||||
},
|
||||
"textStyle": {"color": "#fff"},
|
||||
"backgroundColor": "rgba(96,98,102,0.8)",
|
||||
"borderColor": "rgba(255,255,255,0.3)",
|
||||
"borderWidth": 1
|
||||
},
|
||||
"legend": {
|
||||
"data": ["城区", "镇区", "乡村", "总入园数", "2022年基数"],
|
||||
"top": 0,
|
||||
"textStyle": {"color": "#fff"},
|
||||
"icon": "roundRect",
|
||||
"itemWidth": 12,
|
||||
"itemHeight": 12
|
||||
},
|
||||
"xAxis": [
|
||||
{
|
||||
"type": "category",
|
||||
"data": years,
|
||||
"axisPointer": {"type": "shadow"},
|
||||
"axisLine": {"lineStyle": {"color": "#fff"}},
|
||||
"axisLabel": {"color": "#fff"},
|
||||
"nameTextStyle": {"color": "#fff"}
|
||||
}
|
||||
],
|
||||
"yAxis": [
|
||||
{
|
||||
"type": "value",
|
||||
|
||||
"axisLabel": {
|
||||
"formatter": "{value}"
|
||||
, "color": "#fff"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "value",
|
||||
|
||||
"axisLabel": {"formatter": "{value}", "color": "#fff"},
|
||||
},
|
||||
|
||||
],
|
||||
"series": [
|
||||
{
|
||||
"name": "城区",
|
||||
"type": "bar",
|
||||
"data": urban_data,
|
||||
"itemStyle": {
|
||||
"borderRadius": [6, 6, 0, 0],
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "镇区",
|
||||
"type": "bar",
|
||||
"data": town_data,
|
||||
"itemStyle": {
|
||||
"borderRadius": [6, 6, 0, 0],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "乡村",
|
||||
"type": "bar",
|
||||
"data": rural_data,
|
||||
"itemStyle": {
|
||||
"borderRadius": [6, 6, 0, 0]
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "总入园数",
|
||||
"type": "line",
|
||||
"yAxisIndex": 1,
|
||||
"data": total_enroll
|
||||
},
|
||||
# 添加2022年基数的粉色折线
|
||||
{
|
||||
"name": "2022年基数",
|
||||
"type": "line",
|
||||
"yAxisIndex": 1,
|
||||
"data": base_2022_line
|
||||
}
|
||||
]
|
||||
}
|
||||
return option
|
||||
>>>>>>> 40a7a8fb7a0a8fc3ffc2f362b46acfceda2a1602
|
||||
|
||||
@staticmethod
|
||||
def generate_in_school_education_config():
|
||||
|
BIN
Model/__pycache__/RuYuanZaiYuanCountModel.cpython-312.pyc
Normal file
BIN
Model/__pycache__/RuYuanZaiYuanCountModel.cpython-312.pyc
Normal file
Binary file not shown.
BIN
Model/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
Model/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
180
static/css/index.css
Normal file
180
static/css/index.css
Normal file
@@ -0,0 +1,180 @@
|
||||
@charset "utf-8";
|
||||
/* CSS Document */
|
||||
*{
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box}
|
||||
*,body{padding:0px; margin:0px;font-family: "微软雅黑";}
|
||||
body{ background:#000d4a url(../images/bg.jpg) center center; background-size:cover;color:#fff; font-size: .1rem; }
|
||||
li{ list-style-type:none;}
|
||||
/* @font-face{font-family:electronicFont;src:url(../font/DS-DIGIT.TTF)} */
|
||||
i{ margin:0px; padding:0px; text-indent:0px;}
|
||||
img{ border:none; max-width: 100%;}
|
||||
a{ text-decoration:none; color:#399bff;}
|
||||
a.active,a:focus{ outline:none!important; text-decoration:none;}
|
||||
ol,ul,p,h1,h2,h3,h4,h5,h6{ padding:0; margin:0}
|
||||
a:hover{ color:#06c; text-decoration: none!important}
|
||||
|
||||
html,body{height: 100%;}
|
||||
.clearfix:after, .clearfix:before {display: table;content: " "}
|
||||
.clearfix:after {clear: both}
|
||||
.pulll_left{float:left;}
|
||||
.pulll_right{float:right;}
|
||||
/*谷哥滚动条样式*/
|
||||
::-webkit-scrollbar {width:5px;height:5px;position:absolute}
|
||||
::-webkit-scrollbar-thumb {background-color:#5bc0de}
|
||||
::-webkit-scrollbar-track {background-color:#ddd}
|
||||
/***/
|
||||
|
||||
.loading{position:fixed; left:0; top:0; font-size:16px; z-index:100000000;width:100%; height:100%; background:#1a1a1c; text-align:center;}
|
||||
.loadbox{position:absolute; width:160px;height:150px; color: #324e93; left:50%; top:50%; margin-top:-100px; margin-left:-75px;}
|
||||
.loadbox img{ margin:10px auto; display:block; width:40px;}
|
||||
|
||||
.head{ height:1.05rem; background: url(../images/head_bg.png) no-repeat center center; background-size: 100% 100%; position: relative}
|
||||
.head h1{ color:#fff; text-align: center; font-size: .4rem; line-height:.8rem; letter-spacing: -1px;}
|
||||
.head h1 img{ width:1.5rem; display: inline-block; vertical-align: middle; }
|
||||
.time{ position:absolute; right:.15rem; top:0; line-height: .75rem;color:rgba(255,255,255,.7); font-size: .3rem; padding-right: .1rem;font-family:electronicFont;}
|
||||
|
||||
.mainbox{ padding:0 .2rem 0rem .2rem; height:calc(100% - 1.05rem) }
|
||||
.mainbox>ul{ margin-left:-.1rem; margin-right:-.1rem; height:100%}
|
||||
.mainbox>ul>li{ float: left; padding: 0 .1rem;height:100%;width: 30%}
|
||||
.mainbox>ul>li:nth-child(2){ width: 40%}
|
||||
|
||||
.boxall{ padding:0 .2rem .2rem .2rem; background: rgba(6,48,109,.5); position: relative; margin-bottom: .15rem; z-index: 10; }
|
||||
.alltitle{ font-size:.2rem; color:#fff; line-height: .5rem; position: relative;padding-left: .15rem}
|
||||
.alltitle:before{position: absolute; height: .2rem; width: 4px; background: #49bcf7; border-radius: 5px; content: ""; left: 0; top: 50%; margin-top: -.1rem;}
|
||||
|
||||
/* 标签切换器样式 - 小巧居中版本 */
|
||||
.tab-switcher {
|
||||
display: inline-flex;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: .12rem;
|
||||
padding: .03rem;
|
||||
margin-bottom: .08rem;
|
||||
border: 1px solid rgba(73, 188, 247, 0.3);
|
||||
height: .3rem;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
min-width: 1.2rem;
|
||||
text-align: center;
|
||||
padding: .08rem .2rem;
|
||||
cursor: pointer;
|
||||
border-radius: .1rem;
|
||||
font-size: .14rem;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
transition: all 0.2s ease;
|
||||
background: transparent;
|
||||
line-height: 1.2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.tab-item:hover {
|
||||
background: rgba(73, 188, 247, 0.2);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
background: linear-gradient(135deg, #49bcf7, #2b95d6);
|
||||
color: #fff;
|
||||
box-shadow: 0 1px 4px rgba(73, 188, 247, 0.3);
|
||||
/* font-weight: bold; */
|
||||
}
|
||||
|
||||
.tab-item:first-child {
|
||||
margin-right: .03rem;
|
||||
}
|
||||
|
||||
.tab-item:last-child {
|
||||
margin-left: .03rem;
|
||||
}
|
||||
|
||||
/* 标题行布局样式 */
|
||||
.title-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: .1rem;
|
||||
}
|
||||
|
||||
.right-content {
|
||||
font-size: .14rem;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
padding: .05rem .15rem;
|
||||
background: rgba(73, 188, 247, 0.2);
|
||||
border-radius: .08rem;
|
||||
border: 1px solid rgba(73, 188, 247, 0.3);
|
||||
}
|
||||
|
||||
|
||||
.boxnav{height: calc(100% - .80rem);}
|
||||
.row>li{ float: left; height: 100%;}
|
||||
.col-6{width: 50%;}
|
||||
.col-3{width: 25%;}
|
||||
.col-4{width: 33.33333%;}
|
||||
.h100{height: 100%;}
|
||||
.tit01{ text-align: center; color: white; font-size: .16rem; padding: .3rem 0 .02rem 0;}
|
||||
.piebox{ height: calc(100% - .5rem); position: relative;}
|
||||
.piebox:before{ width:.6rem; height:.6rem; content: ""; border: 1px solid #49bcf7; border-radius: 1rem; position: absolute;
|
||||
left:50%; top: 50%; margin-left: -.31rem; margin-top: -.31rem; opacity: .7;}
|
||||
|
||||
.sqzs{margin-right: .2rem;}
|
||||
.sqzs p{ padding: .2rem 0 .1rem 0; font-size: .22rem;}
|
||||
.sqzs h1{height: calc(100% - .65rem); border-bottom: 1px solid rgba(255,255,255,.1); border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; color: #fef000;font-weight: normal; letter-spacing: 2px; font-size: .5rem; justify-content: center;padding-bottom: .05rem;}
|
||||
.sqzs h1 span{ font-size: .8rem; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; }
|
||||
|
||||
table{ width: 100%; text-align: center;}
|
||||
table th{ font-size: .16rem; background: rgba(0,0,0,.1);}
|
||||
table td{ font-size: .16rem; color: rgba(255,255,255,.6);}
|
||||
table th,table td{ border-bottom:1px solid rgba(255,255,255,.1); padding: .1rem 0;}
|
||||
|
||||
select.right-content {
|
||||
font-size: .14rem;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
padding: .05rem .15rem;
|
||||
background: rgba(73, 188, 247, 0.2);
|
||||
border-radius: .08rem;
|
||||
border: 1px solid rgba(73, 188, 247, 0.3);
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2349bcf7'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right .1rem center;
|
||||
background-size: .12rem;
|
||||
padding-right: .3rem;
|
||||
}
|
||||
|
||||
/* 下拉菜单选项样式 - 与整体颜色一致 */
|
||||
select.right-content option {
|
||||
background-color: rgba(6, 48, 109, 0.9); /* 深蓝色背景,与页面主色调一致 */
|
||||
color: #fff; /* 白色文字 */
|
||||
padding: .1rem .15rem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 鼠标悬停状态的选项 */
|
||||
select.right-content option:hover {
|
||||
background-color: rgba(73, 188, 247, 0.5); /* 中等蓝色背景 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
select.right-content:hover {
|
||||
background-color: rgba(73, 188, 247, 0.3);
|
||||
/* background-color: red; */
|
||||
}
|
||||
|
||||
select.right-content:focus {
|
||||
border-color: rgba(73, 188, 247, 0.3);
|
||||
box-shadow: 0 0 0 2px rgba(73, 188, 247, 0.2);
|
||||
}
|
||||
|
||||
|
||||
|
BIN
static/images/.DS_Store
vendored
Normal file
BIN
static/images/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
static/images/7272131289845600256.jpg
Normal file
BIN
static/images/7272131289845600256.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1022 KiB |
BIN
static/images/bg.jpg
Normal file
BIN
static/images/bg.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
BIN
static/images/head_bg.png
Normal file
BIN
static/images/head_bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
static/images/head_bg1.png
Normal file
BIN
static/images/head_bg1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
static/images/loading.gif
Normal file
BIN
static/images/loading.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 701 B |
174
static/index.html
Normal file
174
static/index.html
Normal file
@@ -0,0 +1,174 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>大数据可视化系统数据分析通用模版</title>
|
||||
<script type="text/javascript" src="js/jquery.js"></script>
|
||||
<link rel="stylesheet" href="css/index.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="loading">
|
||||
<div class="loadbox">
|
||||
<img src="images/loading.gif" /> 页面加载中...
|
||||
</div>
|
||||
</div>
|
||||
<div class="head">
|
||||
<h1>大数据可视化系统数据分析</h1>
|
||||
</div>
|
||||
<div class="mainbox">
|
||||
<ul class="clearfix">
|
||||
<li>
|
||||
<div class="boxall" style="height: calc(33.333% - .15rem)">
|
||||
<div class="alltitle">
|
||||
学前教育规模发展预测
|
||||
</div>
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<div class="tab-switcher">
|
||||
<div class="tab-item active" data-tab="入园数">入园数总量</div>
|
||||
<div class="tab-item" data-tab="在园数">在园数总量</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxnav" id="echarts01">
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxall" style="height: calc(33.333% - .15rem)">
|
||||
<div class="title-row">
|
||||
<div class="alltitle">
|
||||
义务教育规模发展预测
|
||||
</div>
|
||||
<select class="right-content">
|
||||
<option value="cz">初中</option>
|
||||
<option value="gz">高中</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<div class="tab-switcher">
|
||||
<div class="tab-item active" data-tab="招生数">招生数总量</div>
|
||||
<div class="tab-item" data-tab="在校数">在校生总量</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxnav" id="echarts02"></div>
|
||||
</div>
|
||||
<div class="boxall" style="height: calc(33.333% - .15rem)">
|
||||
<div class="alltitle">
|
||||
高中阶段教育规模发展预测
|
||||
</div>
|
||||
<div class="boxnav" id="echarts03"></div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="boxall" style="height: calc(20% - .15rem)">
|
||||
<ul class="row h100 clearfix">
|
||||
<li class="col-6">
|
||||
<div class="sqzs h100">
|
||||
<p>业绩总览</p>
|
||||
<h1><span>30500</span>万</h1>
|
||||
</div>
|
||||
</li>
|
||||
<li class="col-6">
|
||||
<ul class="row h100 clearfix">
|
||||
<li class="col-4">
|
||||
<div class="tit01">
|
||||
标题名称
|
||||
</div>
|
||||
<div class="piebox" id="pe01"></div>
|
||||
</li>
|
||||
<li class="col-4">
|
||||
<div class="tit01">
|
||||
标题名称
|
||||
</div>
|
||||
<div class="piebox" id="pe02"></div>
|
||||
</li>
|
||||
<li class="col-4">
|
||||
<div class="tit01">
|
||||
标题名称
|
||||
</div>
|
||||
<div class="piebox" id="pe03"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="boxall" style="height: calc(38% - .15rem)">
|
||||
<div class="alltitle">
|
||||
标题名称1
|
||||
</div>
|
||||
<div class="boxnav" id="echarts4"></div>
|
||||
</div>
|
||||
<div class="boxall" style="height: calc(42% - .15rem)">
|
||||
<div class="alltitle">
|
||||
标题名称2
|
||||
</div>
|
||||
<div class="boxnav" id="echarts2"></div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="boxall" style="height: calc(33.333% - .15rem)">
|
||||
<div class="alltitle">
|
||||
标题名称3
|
||||
</div>
|
||||
<div class="boxnav" id="echarts5"></div>
|
||||
</div>
|
||||
<div class="boxall" style="height: calc(33.333% - .15rem)">
|
||||
<div class="alltitle">
|
||||
标题名称
|
||||
</div>
|
||||
<div class="boxnav" id="">
|
||||
<table border="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>字段</th>
|
||||
<th>字段</th>
|
||||
<th>字段</th>
|
||||
<th>字段</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<td>8098</td>
|
||||
<td>19.80%</td>
|
||||
<td>22</td>
|
||||
<td>368</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<td>7506</td>
|
||||
<td>6.70%</td>
|
||||
<td>22</td>
|
||||
<td>339</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<td>3261</td>
|
||||
<td>32.30%</td>
|
||||
<td>10</td>
|
||||
<td>325.7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>字段</th>
|
||||
<td>1993</td>
|
||||
<td> 201%</td>
|
||||
<td>10</td>
|
||||
<td> 199</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="boxall" style="height: calc(33.333% - .15rem)">
|
||||
<div class="alltitle">
|
||||
标题名称
|
||||
</div>
|
||||
<div class="boxnav" id="echarts6" style="height:calc(100% - .3rem);"></div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- <script type="text/javascript" src="js/echarts.min.js"></script> -->
|
||||
<script type="text/javascript" src="https://gcore.jsdelivr.net/npm/echarts@6.0.0/dist/echarts.min.js"></script>
|
||||
<script language="JavaScript" src="js/index.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
328
static/js/index.js
Normal file
328
static/js/index.js
Normal file
@@ -0,0 +1,328 @@
|
||||
$(window).load(function () {
|
||||
$(".loading").fadeOut();
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
var whei = $(window).width();
|
||||
$("html").css({ fontSize: whei / 20 });
|
||||
$(window).resize(function () {
|
||||
var whei = $(window).width();
|
||||
$("html").css({ fontSize: whei / 20 });
|
||||
});
|
||||
});
|
||||
|
||||
$(window).load(function () {
|
||||
$(".loading").fadeOut();
|
||||
});
|
||||
|
||||
$(function () {
|
||||
echarts_1();
|
||||
echarts_2();
|
||||
// echarts_3();
|
||||
|
||||
function echarts_1() {
|
||||
var myChart = echarts.init(document.getElementById("echarts01"));
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
async: false,
|
||||
dataType: "json",
|
||||
url: "/RuYuanZaiYuan/school/preschool/chart",
|
||||
success: function (option) {
|
||||
console.log(option);
|
||||
option.grid = {
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 30,
|
||||
bottom: 0,
|
||||
containLabel: true,
|
||||
};
|
||||
|
||||
option.textStyle = {
|
||||
color: "#fff",
|
||||
};
|
||||
|
||||
option.tooltip = {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "cross",
|
||||
crossStyle: { color: "#999" },
|
||||
},
|
||||
textStyle: { color: "#fff" },
|
||||
// 1. 背景色
|
||||
backgroundColor: "rgba(96,98,102,0.8)", // 半透明黑
|
||||
// 2. 边框
|
||||
borderColor: "rgba(255,255,255,0.3)",
|
||||
borderWidth: 1,
|
||||
};
|
||||
|
||||
option.series.forEach((seriesItem, index) => {
|
||||
seriesItem.tooltip = { valueFormatter: (v) => v + " 万人" };
|
||||
});
|
||||
|
||||
|
||||
|
||||
myChart.setOption(option);
|
||||
window.addEventListener("resize", function () {
|
||||
myChart.resize();
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function echarts_2() {
|
||||
var myChart = echarts.init(document.getElementById("echarts02"));
|
||||
|
||||
option = {
|
||||
grid: {
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 40,
|
||||
bottom: 0,
|
||||
containLabel: true,
|
||||
},
|
||||
textStyle: {
|
||||
color: "#fff",
|
||||
},
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "cross",
|
||||
crossStyle: { color: "#999" },
|
||||
},
|
||||
textStyle: { color: "#fff" },
|
||||
// 1. 背景色
|
||||
backgroundColor: "rgba(96,98,102,0.8)", // 半透明黑
|
||||
// 2. 边框
|
||||
borderColor: "rgba(255,255,255,0.3)",
|
||||
borderWidth: 1,
|
||||
},
|
||||
legend: {
|
||||
data: ["城区", "镇区", "乡村", "总入园数", "2022年基数"],
|
||||
top: 0,
|
||||
textStyle: { color: "#fff" },
|
||||
icon: "roundRect",
|
||||
itemWidth: 12,
|
||||
itemHeight: 12,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
data: ["2019", "2021", "2022", "2023", "2024", "2025", "2026"],
|
||||
axisPointer: { type: "shadow" },
|
||||
axisLine: { lineStyle: { color: "#fff" } },
|
||||
axisLabel: { color: "#fff" },
|
||||
nameTextStyle: { color: "#fff" },
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
min: 0,
|
||||
max: 250,
|
||||
interval: 50,
|
||||
axisLabel: { formatter: "{value}", color: "#fff" },
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
min: 0,
|
||||
max: 25,
|
||||
interval: 5,
|
||||
axisLabel: { formatter: "{value}", color: "#fff" },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "城区",
|
||||
type: "bar",
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6],
|
||||
itemStyle: {
|
||||
borderRadius: [6, 6, 0, 0],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "镇区",
|
||||
type: "bar",
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6],
|
||||
itemStyle: {
|
||||
borderRadius: [6, 6, 0, 0],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "乡村",
|
||||
type: "bar",
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [2.4, 5.2, 8.0, 25.4, 27.7, 73.7, 155.6],
|
||||
itemStyle: {
|
||||
borderRadius: [6, 6, 0, 0],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "总入园数",
|
||||
type: "line",
|
||||
yAxisIndex: 1,
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3],
|
||||
},
|
||||
// 2. 新增折线
|
||||
{
|
||||
name: "2022年基数",
|
||||
type: "line",
|
||||
yAxisIndex: 1,
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
// 3. 数据整体 +0.8
|
||||
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3].map((v) =>
|
||||
(v + 0.8).toFixed(1)
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
myChart.setOption(option);
|
||||
window.addEventListener("resize", function () {
|
||||
myChart.resize();
|
||||
});
|
||||
}
|
||||
|
||||
function echarts_3() {
|
||||
var myChart = echarts.init(document.getElementById("echarts01"));
|
||||
|
||||
option = {
|
||||
grid: {
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 40,
|
||||
bottom: 0,
|
||||
containLabel: true,
|
||||
},
|
||||
textStyle: {
|
||||
color: "#fff",
|
||||
},
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "cross",
|
||||
crossStyle: { color: "#999" },
|
||||
},
|
||||
textStyle: { color: "#fff" },
|
||||
// 1. 背景色
|
||||
backgroundColor: "rgba(96,98,102,0.8)", // 半透明黑
|
||||
// 2. 边框
|
||||
borderColor: "rgba(255,255,255,0.3)",
|
||||
borderWidth: 1,
|
||||
},
|
||||
legend: {
|
||||
data: ["城区", "镇区", "乡村", "总入园数", "2022年基数"],
|
||||
top: 0,
|
||||
textStyle: { color: "#fff" },
|
||||
icon: "roundRect",
|
||||
itemWidth: 12,
|
||||
itemHeight: 12,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
data: ["2019", "2021", "2022", "2023", "2024", "2025", "2026"],
|
||||
axisPointer: { type: "shadow" },
|
||||
axisLine: { lineStyle: { color: "#fff" } },
|
||||
axisLabel: { color: "#fff" },
|
||||
nameTextStyle: { color: "#fff" },
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
min: 0,
|
||||
max: 250,
|
||||
interval: 50,
|
||||
axisLabel: { formatter: "{value}", color: "#fff" },
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
min: 0,
|
||||
max: 25,
|
||||
interval: 5,
|
||||
axisLabel: { formatter: "{value}", color: "#fff" },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "城区",
|
||||
type: "bar",
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [201.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6],
|
||||
itemStyle: {
|
||||
borderRadius: [6, 6, 0, 0],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "镇区",
|
||||
type: "bar",
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6],
|
||||
itemStyle: {
|
||||
borderRadius: [6, 6, 0, 0],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "乡村",
|
||||
type: "bar",
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [2.4, 5.2, 8.0, 25.4, 27.7, 73.7, 155.6],
|
||||
itemStyle: {
|
||||
borderRadius: [6, 6, 0, 0],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "总入园数",
|
||||
type: "line",
|
||||
yAxisIndex: 1,
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3],
|
||||
},
|
||||
// 2. 新增折线
|
||||
{
|
||||
name: "2022年基数",
|
||||
type: "line",
|
||||
yAxisIndex: 1,
|
||||
tooltip: { valueFormatter: (v) => v + " 万人" },
|
||||
// 3. 数据整体 +0.8
|
||||
data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3].map((v) =>
|
||||
(v + 0.8).toFixed(1)
|
||||
),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
myChart.setOption(option);
|
||||
window.addEventListener("resize", function () {
|
||||
myChart.resize();
|
||||
});
|
||||
}
|
||||
|
||||
$(".tab-item").click(function () {
|
||||
// 移除所有active类
|
||||
$(this).siblings().removeClass("active");
|
||||
// 添加active类到当前点击的元素
|
||||
$(this).addClass("active");
|
||||
|
||||
// 获取当前选中的标签数据
|
||||
var selectedTab = $(this).data("tab");
|
||||
|
||||
// 这里可以添加根据标签切换内容的逻辑
|
||||
console.log("切换到: " + selectedTab);
|
||||
|
||||
// 示例:根据标签切换图表数据
|
||||
switch (selectedTab) {
|
||||
case "入园数":
|
||||
// 加载入园数数据
|
||||
echarts_1();
|
||||
break;
|
||||
case "在园数":
|
||||
echarts_3();
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
5
static/js/jquery.js
vendored
Normal file
5
static/js/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user