var E_chart = [];
$(function () {
// 渲染年份列表 在nav.js中获取select_year
$('#select-year').append(select_year)
// 标题增加年份
$('#title_text').prepend(config_now_year)
$('.select').on('click', '.placeholder', function (e) {
var parent = $(this).closest('.select');
if (!parent.hasClass('is-open')) {
parent.addClass('is-open');
$('.select.is-open').not(parent).removeClass('is-open');
} else {
parent.removeClass('is-open');
}
e.stopPropagation();
}).on('click', 'ul>li', function () {
var parent = $(this).closest('.select');
parent.removeClass('is-open').find('.placeholder').text($(this).text());
$(window).attr('location', "index.html?year=" + $(this).text());
let on_year = $(this).text();
echarts_1(on_year); // 各阶段学校数量
echarts_2(on_year); //学校规模情况
echarts_4(on_year); //办学条件情况
echarts_6(on_year); //城乡专任教师师生比
echarts_7(on_year); //随迁子女情况(高中)
echarts_8(on_year); //随迁子女情况(初中)
echarts_9(on_year); //学生情况
echarts_10(on_year); // 班额情况
echarts_11(on_year); //留守儿童情况
echarts_31(on_year); // 专任教师师生比-小学
echarts_32(on_year); // 专任教师师生比-初中
echarts_33(on_year); // 专任教师师生比-高中
echarts_all(on_year);
});
var typeOfBe = 'small';
$('#BExiaoxue').click(function (event) {
$(this).addClass('active');
$(this).siblings().removeClass('active');
typeOfBe = 'small';
echarts_10(config_now_year);
})
$('#BEchuzhong').click(function (event) {
$(this).addClass('active');
$(this).siblings().removeClass('active');
typeOfBe = 'middle';
echarts_10(config_now_year);
})
$('#BEgaozhong').click(function (event) {
$(this).addClass('active');
$(this).siblings().removeClass('active');
typeOfBe = 'height';
echarts_10(config_now_year);
})
var typeOfSqzn = 'small';
$('#SQxiaoxue').click(function (event) {
$(this).addClass('active');
$(this).siblings().removeClass('active');
typeOfSqzn = 'small';
echarts_7(config_now_year);
echarts_8(config_now_year);
})
$('#SQchuzhong').click(function (event) {
$(this).addClass('active');
$(this).siblings().removeClass('active');
typeOfSqzn = 'middle';
echarts_7(config_now_year);
echarts_8(config_now_year);
})
$('#SQgaozhong').click(function (event) {
$(this).addClass('active');
$(this).siblings().removeClass('active');
typeOfSqzn = 'height';
echarts_7(config_now_year);
echarts_8(config_now_year);
})
echarts_1(config_now_year); // 各阶段学校数量
echarts_2(config_now_year); //学校规模情况
echarts_4(config_now_year); //办学条件情况
echarts_6(config_now_year); //城乡专任教师师生比
echarts_7(config_now_year); //随迁子女情况(高中)
echarts_8(config_now_year); //随迁子女情况(初中)
echarts_9(config_now_year); //学生情况
echarts_10(config_now_year); // 班额情况
echarts_11(config_now_year); //留守儿童情况
echarts_31(config_now_year); // 专任教师师生比-小学
echarts_32(config_now_year); // 专任教师师生比-初中
echarts_33(config_now_year); // 专任教师师生比-高中
echarts_all(config_now_year);
// 各阶段学校数量
function echarts_1(year) {
// 各阶段学校数量
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A011",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"stage"
]
}), function (resport) {
var data = resport.result;
var indata = JSON.parse(data);
newData = dataToChar(indata);
// 基于准备好的dom,初始化echarts实例
myChart = echarts.init(document.getElementById('echart_school_number1')); // 各阶段学校数量
// E_chart[0] = myChart;
E_chart.push(myChart);
option = {
title: {
text: '',
left: 'center',
textStyle: {
color: '#fff',
fontSize: '16'
}
},
legend: {
top: '70%',
itemWidth: 10,
itemHeight: 10,
data: indata.groups[0],
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
}
},
tooltip: {
trigger: 'item'
},
series: [
{
name: '',
type: 'pie',
radius: '50%',
center: ['50%', '40%'],
color: ['#168EFE', '#8882F7', '#FFA06C', '#FFDB65', '#2CD1C0', '#FF88A8'],
data: newData,
label: { show: false },
labelLine: { show: false },
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
animationDelay: function (idx) {
return idx * 100;
}
}
]
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
// 学校规模情况
function echarts_2(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A010",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart_school_size2')); // 学校规模情况
E_chart.push(myChart);
option = {
// backgroundColor: '#00265f',
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' }
},
grid: {
left: '0%',
top: '10px',
right: '0%',
bottom: '4%',
containLabel: true
},
xAxis: [{
type: 'category',
data: newData.groups[0],
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1)",
width: 1,
type: "solid"
},
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
// rotate:50,
show: true,
splitNumber: 15,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
}],
yAxis: [{
type: 'value',
axisLabel: {
//formatter: '{value} %'
show: true,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
axisTick: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1 )",
width: 1,
type: "solid"
},
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,.1)",
type: 'dashed'
}
}
}],
series: [
{
type: 'bar',
data: newData.datas[0],
barWidth: '35%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#FFA06C',
opacity: 1,
barBorderRadius: 5,
}
},
}
],
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json')
}
// 办学条件情况
function echarts_4(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A009",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total", "studentno"
],
"query_format": "echarts",
"query_group": [
"stage", "citycountrygroup"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
var cityNum = [];// 城区
var townNum = [];// 镇区
var ruralNum = [];// 乡村
newData.datas[0].map((item, index) => {
cityNum.push((item / newData.datas2[0][index]).toFixed(2));
})
newData.datas[1].map((item, index) => {
townNum.push((item / newData.datas2[1][index]).toFixed(2));
})
newData.datas[2].map((item, index) => {
ruralNum.push((item / newData.datas2[2][index]).toFixed(2));
})
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart_school_condition3')); // 办学条件情况
E_chart.push(myChart);
option = {
// backgroundColor: '#00265f',
title: [{
text: '城乡生均占地面积情况',
// subtext: 'From ExcelHome',
left: 'left',
textStyle: {
color: '#fff',
fontSize: '12'
}
}],
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' }
},
legend: {
data: newData.groups[1],
textStyle: {
color: '#fff'
}
},
grid: {
left: '0%',
top: '14%',
right: '0%',
bottom: '4%',
containLabel: true
},
xAxis: [{
type: 'category',
data: newData.groups[0],
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1)",
width: 1,
type: "solid"
},
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
// rotate:50,
show: true,
splitNumber: 15,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
}],
yAxis: [{
type: 'value',
axisLabel: {
//formatter: '{value} %'
show: true,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
axisTick: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1 )",
width: 1,
type: "solid"
},
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,.1)",
type: 'dashed'
}
}
}],
series: [
{
name: '城区',
type: 'bar',
data: cityNum,
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#168EFE',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: '镇区',
type: 'bar',
data: townNum,
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#FFDB65',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: '乡村',
type: 'bar',
data: ruralNum,
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#2CD1C0',
opacity: 1,
barBorderRadius: 5,
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json')
}
// 城乡专任教师师生比
function echarts_6(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A003",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"studentno", "teacherno"
],
"query_format": "echarts",
"query_group": [
"stage", "citycountrygroup"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
var cityNum = [];// 城区
var townNum = [];// 镇区
var ruralNum = [];// 乡村
newData.datas[1].map((item, index) => {
cityNum.push(((item / newData.datas2[1][index])).toFixed(2));
})
newData.datas[2].map((item, index) => {
townNum.push((item / newData.datas2[2][index]).toFixed(2));
})
newData.datas[0].map((item, index) => {
ruralNum.push((item / newData.datas2[0][index]).toFixed(2));
})
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('city_taacher_and_student6')); // 城乡专任教师师生比
E_chart.push(myChart);
option = {
// backgroundColor: '#00265f',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: newData.groups[1],
textStyle: {
color: '#fff'
}
},
grid: {
left: '0%',
top: '14%',
right: '0%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
data: newData.groups[0],
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1)",
width: 1,
type: "solid"
},
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
// rotate:50,
show: true,
splitNumber: 15,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
}],
yAxis: [{
type: 'value',
axisLabel: {
//formatter: '{value} %'
show: true,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
axisTick: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1 )",
width: 1,
type: "solid"
},
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,.1)",
type: 'dashed'
}
}
}],
series: [
{
name: newData.groups[1][0],
type: 'bar',
data: cityNum,
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#168EFE',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: newData.groups[1][1],
type: 'bar',
data: townNum,
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#8882F7',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: newData.groups[1][2],
type: 'bar',
data: ruralNum,
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#FFA06C',
opacity: 1,
barBorderRadius: 5,
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json')
}
// 随迁子女情况(高中)
function echarts_7(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A006",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"didgroup", "stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
var thisProvince = typeOfSqzn === 'small' ? newData.datas[0][0] : typeOfSqzn === 'middle' ? newData.datas[1][0] : newData.datas[2][0];
var otherProvinces = typeOfSqzn === 'small' ? newData.datas[0][1] : typeOfSqzn === 'middle' ? newData.datas[1][1] : newData.datas[2][1];
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart7')); // 随迁子女情况
E_chart.push(myChart);
option = {
title: {
text: '',
left: 'center',
textStyle: {
color: '#fff',
fontSize: '16'
}
},
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
legend: {
show: false,
},
series: [
{
name: '访问来源',
type: 'pie',
color: ['#FF88A8', '#168EFE'],
radius: '50%',
data: [
{ value: thisProvince, name: '本省迁入' },
{ value: otherProvinces, name: '外省迁入' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
// 随迁子女情况(初中)
function echarts_8(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A006",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"didgroup", "stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
var OnCampusStudents = typeOfSqzn === 'small' ? newData.datas[0][2] : typeOfSqzn === 'middle' ? newData.datas[1][2] : newData.datas[2][2];
var AccompanyingChildren = typeOfSqzn === 'small' ? Number(newData.datas[0][0]) + Number(newData.datas[0][1]) : typeOfSqzn === 'middle' ? Number(newData.datas[1][0]) + Number(newData.datas[1][1]) : Number(newData.datas[2][0]) + Number(newData.datas[2][1]);
var unAccompanyingChildren = typeOfSqzn === 'small' ? OnCampusStudents - AccompanyingChildren : typeOfSqzn === 'middle' ? OnCampusStudents - AccompanyingChildren : OnCampusStudents - AccompanyingChildren;
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart8')); //
E_chart.push(myChart);
option = {
title: {
text: '',
left: 'center',
textStyle: {
color: '#fff',
fontSize: '16'
}
},
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
legend: {
show: false,
},
series: [
{
name: '访问来源',
type: 'pie',
radius: '50%',
color: ['#168EFE', '#FFA06C'],
data: [
{ value: unAccompanyingChildren, name: '非随迁子女' },
{ value: AccompanyingChildren, name: '随迁子女' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
// 学生情况
function echarts_9(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A008",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"didgroup", "stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('student_situation9')); // 留守儿童情况
E_chart.push(myChart);
option = {
// backgroundColor: '#00265f',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: newData.groups[1],
textStyle: {
color: '#fff'
}
},
grid: {
left: '0%',
top: '10px',
right: '0%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
data: newData.groups[0],
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1)",
width: 1,
type: "solid"
},
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
// rotate:50,
show: true,
splitNumber: 15,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
}],
yAxis: [{
type: 'value',
axisLabel: {
//formatter: '{value} %'
show: true,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
axisTick: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1 )",
width: 1,
type: "solid"
},
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,.1)",
type: 'dashed'
}
}
}],
series: [
{
name: '小学',
type: 'bar',
data: newData.datas[0],
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#8882F7',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: '初中',
type: 'bar',
data: newData.datas[1],
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#FFA06C',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: '高中',
type: 'bar',
data: newData.datas[2],
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#2CD1C0',
opacity: 1,
barBorderRadius: 5,
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json')
}
// 班额情况
function echarts_10(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A007",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"didgroup", "stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// debugger
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('class_capacity10')); // 班额情况
E_chart.push(myChart);
option = {
// backgroundColor: '#00265f',
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' }
},
grid: {
left: '0%',
top: '0',
right: '5%',
bottom: '16%',
containLabel: true
},
legend: {
show: false
},
xAxis: [{
type: 'value',
axisLabel: {
//formatter: '{value} %'
show: true,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
axisTick: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1 )",
width: 1,
type: "solid"
},
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,.1)",
type: 'dashed'
}
}
}],
yAxis: [{
type: 'category',
data: newData.groups[0],
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1)",
width: 1,
type: "solid"
},
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
// rotate:50,
show: true,
splitNumber: 15,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
}],
series: [
{
name: typeOfBe === 'small' ? '小学' : typeOfBe === 'middle' ? '初中' : '高中',
type: 'bar',
data: typeOfBe === 'small' ? newData.datas[0] : typeOfBe === 'middle' ? newData.datas[1] : newData.datas[2],
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
label: {
show: true,
position: 'right'
},
itemStyle: {
normal: {
color: '#168EFE',
opacity: 1,
barBorderRadius: 5,
}
}
},
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
// 留守儿童情况
function echarts_11(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A005",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "echarts",
"query_group": [
"citycountrygroup", "stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('left_behind_children11')); // 留守儿童情况
E_chart.push(myChart);
option = {
// backgroundColor: '#00265f',
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: newData.groups[1],
textStyle: {
color: '#fff'
}
},
grid: {
left: '0%',
top: '10px',
right: '0%',
bottom: '2%',
containLabel: true
},
xAxis: [{
type: 'category',
data: newData.groups[0],
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1)",
width: 1,
type: "solid"
},
},
axisTick: {
show: false,
},
axisLabel: {
interval: 0,
// rotate:50,
show: true,
splitNumber: 15,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
}],
yAxis: [{
type: 'value',
axisLabel: {
//formatter: '{value} %'
show: true,
textStyle: {
color: "rgba(255,255,255,.6)",
fontSize: '12',
},
},
axisTick: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: "rgba(255,255,255,.1 )",
width: 1,
type: "solid"
},
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,.1)",
type: 'dashed'
}
}
}],
series: [
{
name: '小学',
type: 'bar',
data: newData.datas[0],
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#2CD1C0',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: '初中',
type: 'bar',
data: newData.datas[1],
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#FFDB65',
opacity: 1,
barBorderRadius: 5,
}
}
},
{
name: '高中',
type: 'bar',
data: newData.datas[2] ? newData.datas[2] : [],
barWidth: '15%', //柱子宽度
// barGap: 1, //柱子之间间距
// label: {
// show: true,
// position: 'top'
// },
itemStyle: {
normal: {
color: '#FFDB65',
opacity: 1,
barBorderRadius: 5,
}
}
},
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
// 专任教师师生比-小学
function echarts_31(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A004",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"teacherno", "studentno"
],
"query_format": "json",
"query_group": [
"stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('taacher_and_student1'));
E_chart.push(myChart);
var student_num = (Number(newData[0].studentno) / Number(newData[0].teacherno)).toFixed(2);
option = {
title: [{
text: '小学',
left: 'center',
textStyle: {
color: '#fff',
fontSize: '16'
}
}],
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
legend: {
top: '70%',
itemWidth: 10,
itemHeight: 10,
data: ['教师', '学生'],
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
}
},
graphic: {
type: 'text',
left: 'center',
top: '40%',
style: {
text: `1:${student_num}`,
textAlign: 'center',
fill: '#6EE3DA',
fontSize: '16'
}
},
series: [
{
name: '小学',
type: 'pie',
center: ['50%', '42%'],
radius: ['40%', '60%'],
color: ['#168EFE', '#FFDB65'],
label: { show: true },
labelLine: { show: true },
data: [
{ value: 1, name: '教师' },
{ value: student_num, name: '学生' },
],
emphasis: {
// label: {
// show: true,
// fontSize: '20',
// fontWeight: 'bold',
// formatter: '{c}: {c}'
// },
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
// 专任教师师生比-初中
function echarts_32(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A004",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"teacherno", "studentno"
],
"query_format": "json",
"query_group": [
"stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('taacher_and_student2'));
E_chart.push(myChart);
var student_num = (Number(newData[1].studentno) / Number(newData[1].teacherno)).toFixed(2);
option = {
title: [{
text: '初中',
left: 'center',
textStyle: {
color: '#fff',
fontSize: '16'
}
}],
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
graphic: {
type: 'text',
left: 'center',
top: '40%',
style: {
text: `1:${student_num}`,
textAlign: 'center',
fill: '#6EE3DA',
fontSize: '16'
}
},
legend: {
top: '70%',
itemWidth: 10,
itemHeight: 10,
data: ['教师', '学生'],
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
}
},
series: [
{
name: '初中',
type: 'pie',
center: ['50%', '42%'],
radius: ['40%', '60%'],
color: ['#168EFE', '#FFDB65'],
label: { show: true },
labelLine: { show: true },
data: [
{ value: 1, name: '教师' },
{ value: student_num, name: '学生' },
],
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
// 专任教师师生比-高中
function echarts_33(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A004",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"teacherno", "studentno"
],
"query_format": "json",
"query_group": [
"stage"
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('taacher_and_student3'));
E_chart.push(myChart);
var student_num = (Number(newData[2].studentno) / Number(newData[2].teacherno)).toFixed(2);
option = {
title: [{
text: '高中',
left: 'center',
textStyle: {
color: '#fff',
fontSize: '16'
}
}],
tooltip: {
trigger: 'item',
formatter: "{a}
{b}: {c} ({d}%)",
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
}
},
graphic: {
type: 'text',
left: 'center',
top: '40%',
style: {
text: `1:${student_num}`,
textAlign: 'center',
fill: '#6EE3DA',
fontSize: '16'
}
},
legend: {
top: '70%',
itemWidth: 10,
itemHeight: 10,
data: ['教师', '学生'],
textStyle: {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
}
},
series: [
{
name: '高中',
type: 'pie',
center: ['50%', '42%'],
radius: ['40%', '60%'],
color: ['#168EFE', '#FFDB65'],
label: { show: true },
labelLine: { show: true },
data: [
{ value: 1, name: '教师' },
{ value: student_num, name: '学生' },
],
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});
}, 'json');
}
function echarts_all(year) {
$.post(config_serverIp + "dataex/report/QuerySimpleGP", JSON.stringify({
"access_token": "system_01##20200102030405##a6ce11eab94df48a6ce11eab",
"query": {
"query_id": "A001",
"query_param": [
year
]
},
"query_cache": 0,
"query_count": [
"total"
],
"query_format": "json",
"query_group": [
""
]
}), function (resport) {
var data = resport.result;
var newData = JSON.parse(data);
var allNum;
var random_number = (1 - Math.random() * 0.2)
newData.map((item, index) => {
if (item.didgroup === '学校总数') {
// 学校总数
allNum = Number(newData[index].total);
// var wrong_number = (Number(newData[index].total) * random_number).toFixed();//随机数
var wrong_number = Number(newData[index].total) + "";//随机数
let schoolNumber = document.querySelector("#schoolNumber");
var numberArr = (wrong_number).split("");
let schoolNumberNr = ""
numberArr.map((item) => {
schoolNumberNr += `