parent
8afc1fa9fb
commit
6190c0a510
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,68 @@
|
||||
from flask import Flask, render_template
|
||||
from mydb import MyDB
|
||||
from flask import jsonify
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/hello')
|
||||
def say_hello():
|
||||
return '<html><body><h1>Hello World</h1></body></html>'
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def hello():
|
||||
return render_template('hello.html', name='Jerry')
|
||||
|
||||
|
||||
@app.route('/province_topn_curconfirm')
|
||||
def get_province_curconfirm_topn():
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_province_curconfirm_top5() # results : []
|
||||
return jsonify(pub_date=results[0][2], privinces=[x[0] for x in results], curConfirms=[x[1] for x in results])
|
||||
|
||||
@app.route('/country_topn_curconfirm')
|
||||
def get_country_curconfirm_topn():
|
||||
mydb1 = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb1.get_country_curconfirm_top10() # results : []
|
||||
return jsonify(pub_date=results[0][2], privinces=[x[0] for x in results], curConfirms=[x[1] for x in results])
|
||||
|
||||
@app.route('/province_curconfirm')
|
||||
def get_province_curconfirm():
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_province_curConfirms() # results : [(), (), ...]
|
||||
return jsonify(pub_date=results[0][2], provinces=[x[0] for x in results], curConfirms=[x[1] for x in results])
|
||||
|
||||
@app.route('/country_curconfirm')
|
||||
def get_country_curconfirm():
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_country_curConfirms() # results : [(), (), ...]
|
||||
return jsonify(pub_date=results[0][2], provinces=[x[0] for x in results], curConfirms=[x[1] for x in results])
|
||||
|
||||
@app.route('/guangxi_curconfirm')
|
||||
def get_guangxi_curconfirm():
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_guangxi_curConfirms() # results : [(), (), ...]
|
||||
return jsonify(pub_date=results[0][2], provinces=[x[0] for x in results], curConfirms=[x[1] for x in results])
|
||||
|
||||
|
||||
@app.route('/henan_curconfirm')
|
||||
def get_henan_curconfirm():
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_henan_curConfirms() # results : [(), (), ...]
|
||||
return jsonify(pub_date=results[0][2], provinces=[x[0] for x in results], curConfirms=[x[1] for x in results])
|
||||
|
||||
@app.route('/province_top5')
|
||||
def get_province_topn():
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_province_top5() # results : []
|
||||
return jsonify(pub_date=results[0][4], privinces=[x[0] for x in results], curConfirms=[x[1] for x in results],confirmcount=[x[2] for x in results],curecount=[x[3] for x in results])
|
||||
|
||||
@app.route('/country_top10')
|
||||
def get_country_top10():
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_country_top10() # results : []
|
||||
return jsonify(pub_date=results[0][4], privinces=[x[0] for x in results], curConfirms=[x[1] for x in results],confirmcount=[x[2] for x in results],curecount=[x[3] for x in results])
|
||||
|
||||
app.run()
|
@ -0,0 +1,280 @@
|
||||
import pymysql
|
||||
from datetime import datetime, timedelta
|
||||
import time
|
||||
|
||||
|
||||
class MyDB:
|
||||
def __init__(self, host, user, passwd, db):
|
||||
self.conn = pymysql.connect(host, user, passwd, db)
|
||||
self.cursor = self.conn.cursor()
|
||||
|
||||
def __del__(self):
|
||||
self.conn.close()
|
||||
|
||||
# 获取当然日期
|
||||
def get_cur_date(self):
|
||||
date = datetime.today()
|
||||
curdate = date.strftime('%Y-%m-%d')
|
||||
return curdate
|
||||
|
||||
# 获取前N天的日期
|
||||
def get_pren_date(self, n=1):
|
||||
predate = datetime.today() + timedelta(-n)
|
||||
predate = predate.strftime('%Y-%m-%d')
|
||||
return predate
|
||||
|
||||
# 获取现有确诊人数最多的5个省份
|
||||
def get_province_curconfirm_top5(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = "select provinceName,currentConfirmedCount,pub_date from province_daily_datas where pub_date like '%s' order by currentConfirmedCount desc limit 5" % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = "select provinceName,currentConfirmedCount,pub_date from province_daily_datas where pub_date like '%s' order by currentConfirmedCount desc limit 5" % (predate + '%')
|
||||
print('+++ presql: %s' % sql)
|
||||
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n += 1
|
||||
|
||||
if n >= 30:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(results)
|
||||
return results
|
||||
|
||||
|
||||
#获取当前确诊人数前十的国家
|
||||
def get_country_curconfirm_top10(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = "select country,curConfirm,pub_date from foreign_datas where pub_date like '%s' order by curConfirm desc limit 10" % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = "select country,curConfirm,pub_date from foreign_datas where pub_date like '%s' order by curConfirm desc limit 10" % (predate + '%')
|
||||
print('+++ presql: %s' % sql)
|
||||
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n += 1
|
||||
|
||||
if n >= 30:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
# print(results)
|
||||
return results
|
||||
|
||||
# 获取最新一天每个省份的现有确诊数量
|
||||
def get_province_curConfirms(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = 'select provinceshortName,currentConfirmedCount,pub_date from province_daily_datas where pub_date like "%s"' % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = 'select provinceshortName,currentConfirmedCount,pub_date from province_daily_datas where pub_date like "%s"' % (predate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n += 1
|
||||
|
||||
if n >= 15:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(results)
|
||||
return results
|
||||
|
||||
# 获取最新一天每个国家的现有确诊数量
|
||||
def get_country_curConfirms(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = 'select country,curConfirm,pub_date from foreign_datas where pub_date like "%s"' % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = 'select country,curConfirm,pub_date from foreign_datas where pub_date like "%s"' % (predate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n += 1
|
||||
|
||||
if n >= 15:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(results)
|
||||
return results
|
||||
|
||||
# 获取最新一天广西的现有确诊数量
|
||||
def get_guangxi_curConfirms(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = 'select cityName,confirmedCount,pub_date from city_daily_datas where province="广西" and pub_date like "%s"' % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = 'select cityName,confirmedCount,pub_date from city_daily_datas where province="广西" and pub_date like "%s"' % (predate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n += 1
|
||||
|
||||
if n >= 15:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(results)
|
||||
return results
|
||||
|
||||
# 获取最新一天河南的现有确诊数量
|
||||
def get_henan_curConfirms(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = 'select cityName,curedCount,pub_date from city_daily_datas where province="河南" and pub_date like "%s"' % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = 'select cityName,curedCount,pub_date from city_daily_datas where province="河南" and pub_date like "%s"' % (predate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n += 1
|
||||
|
||||
if n >= 15:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(results)
|
||||
return results
|
||||
|
||||
# 获取现有确诊人数最多的5个省份
|
||||
def get_province_top5(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = "select provinceName,currentConfirmedCount,confirmedCount,curedCount,pub_date from province_daily_datas where pub_date like '%s' order by currentConfirmedCount desc limit 5" % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = "select provinceName,currentConfirmedCount,confirmedCount,curedCount,pub_date from province_daily_datas where pub_date like '%s' order by currentConfirmedCount desc limit 5" % (predate + '%')
|
||||
print('+++ presql: %s' % sql)
|
||||
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n += 1
|
||||
|
||||
if n >= 30:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(results)
|
||||
return results
|
||||
|
||||
# 获取现有确诊人数最多的10个国家的信息
|
||||
def get_country_top10(self):
|
||||
curdate = self.get_cur_date() # 获取当天的日期
|
||||
sql = "select country,curConfirm,confirmed,crued,pub_date from foreign_datas where pub_date like '%s' order by curConfirm desc limit 10" % (curdate + '%')
|
||||
print('+++ sql: %s' % sql)
|
||||
|
||||
results = []
|
||||
try:
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
|
||||
n = 1
|
||||
|
||||
while len(results) <= 0:
|
||||
predate = self.get_pren_date(n)
|
||||
sql = "select country,curConfirm,confirmed,crued,pub_date from foreign_datas where pub_date like '%s' order by curConfirm desc limit 10" % (predate + '%')
|
||||
print('+++ presql: %s' % sql)
|
||||
|
||||
self.cursor.execute(sql)
|
||||
results = self.cursor.fetchall()
|
||||
n += 1
|
||||
|
||||
if n >= 30:
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
#print(results)
|
||||
return results
|
||||
|
||||
'''
|
||||
if __name__ == "__main__":
|
||||
mydb = MyDB('localhost', 'root', 'Aa183365', 'covid19_datas')
|
||||
results = mydb.get_province_curconfirm_top5() # results : []
|
||||
print(type(results[0]))
|
||||
'''
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,60 @@
|
||||
var myCharts7 = echarts.init(document.getElementById("main7"));
|
||||
|
||||
var option7 = {
|
||||
title: {
|
||||
text: '全国各地区现有确诊人数',
|
||||
subtext: '',
|
||||
left: 'center',
|
||||
textStyle:{
|
||||
fontFamily:'微软雅黑'
|
||||
}
|
||||
},
|
||||
tooltip: {},
|
||||
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: [],
|
||||
axisLabel:{
|
||||
interval:0,//横轴信息全部显示
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [{
|
||||
name:'现有确诊病例:',
|
||||
data: [],
|
||||
type: 'bar',
|
||||
label: { //每个柱子顶端显示数值
|
||||
normal: {
|
||||
show: true,
|
||||
position: 'top'
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
||||
// 向后台发起请求,获取数据
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type:"GET",
|
||||
url:"/province_curconfirm",
|
||||
data: null,
|
||||
dataType : "json",
|
||||
async: false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
// pub_date, privinces, curConfirms
|
||||
option7.title.subtext = "数据更新时间: " + result.pub_date
|
||||
for(i=0; i<result.provinces.length; ++i) {
|
||||
option7.xAxis.data.push(result.provinces[i])
|
||||
option7.series[0].data.push(result.curConfirms[i])
|
||||
}
|
||||
print(result)
|
||||
console.info(result)
|
||||
}
|
||||
});
|
||||
|
||||
myCharts7.setOption(option7);
|
@ -0,0 +1,38 @@
|
||||
var myCharts10 = echarts.init(document.getElementById("main10"));
|
||||
var option10 = {
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: []
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
},
|
||||
series: [{
|
||||
data: [],
|
||||
type: 'line'
|
||||
}]
|
||||
};
|
||||
|
||||
// 向后台发起请求,获取数据
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type:"GET",
|
||||
url:"/province_curconfirm",
|
||||
data: null,
|
||||
dataType : "json",
|
||||
async: false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
// pub_date, privinces, curConfirms
|
||||
for(i=0; i<result.provinces.length; ++i) {
|
||||
option10.xAxis.data.push(result.provinces[i])
|
||||
option10.series[0].data.push(result.curConfirms[i])
|
||||
}
|
||||
print(result)
|
||||
console.info(result)
|
||||
}
|
||||
});
|
||||
|
||||
myCharts10.setOption(option10);
|
@ -0,0 +1,64 @@
|
||||
var myCharts1 = echarts.init(document.getElementById("main1"));
|
||||
|
||||
var option1 = {
|
||||
title: {
|
||||
text: '现有确诊人数最多的五个省份',
|
||||
subtext: '',
|
||||
left: 'center',
|
||||
textStyle:{
|
||||
fontFamily:'微软雅黑'
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||
},
|
||||
legend: {
|
||||
type: 'scroll',
|
||||
orient: 'vertical',
|
||||
right: 10,
|
||||
top: 20,
|
||||
bottom: 20,
|
||||
data: []
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '省份',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['40%', '50%'],
|
||||
data: [],
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 向后台发起请求,获取数据
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type:"GET",
|
||||
url:"/province_topn_curconfirm",
|
||||
data: null,
|
||||
dataType : "json",
|
||||
async: false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
// pub_date, privinces, curConfirms
|
||||
option1.title.subtext = "数据更新时间: " + result.pub_date
|
||||
for(i=0; i<result.privinces.length; ++i) {
|
||||
option1.legend.data.push(result.privinces[i])
|
||||
option1.series[0].data.push({name:result.privinces[i], value:result.curConfirms[i]})
|
||||
}
|
||||
console.info(result)
|
||||
}
|
||||
});
|
||||
|
||||
myCharts1.setOption(option1);
|
@ -0,0 +1,141 @@
|
||||
var myCharts3 = echarts.init(document.getElementById('main3'));
|
||||
|
||||
var option3 = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "省份:{b}<br/>确诊:{c}"
|
||||
},
|
||||
textStyle: {color: '#FFFFFF'},
|
||||
title:{
|
||||
left: 'center',
|
||||
text: '中国疫情地图(现有确诊人数)',
|
||||
subtext: '数据更新时间: ',
|
||||
textStyle:{
|
||||
fontSize:20,
|
||||
align:"center"
|
||||
}
|
||||
},
|
||||
visualMap: {
|
||||
left: 'left',
|
||||
top: 'bottom',
|
||||
splitNumber: 7,
|
||||
pieces: [
|
||||
{value: 0},
|
||||
{min: 0, max: 9},
|
||||
{min: 10, max: 49},
|
||||
{min: 50, max: 99},
|
||||
{min: 100, max: 999},
|
||||
{min: 1000, max: 9999},
|
||||
{min: 10000}
|
||||
],
|
||||
textStyle: {
|
||||
color: "#B80909"
|
||||
},
|
||||
inRange: {
|
||||
color: ["#FFFFFF", "#FFE5DB", "#FFC4B3", "#FF9985", "#F57567", "#E64546", "#B80909"]
|
||||
},
|
||||
outOfRange: {
|
||||
color: "#FFFFFF"
|
||||
},
|
||||
show:true
|
||||
},
|
||||
geo:{
|
||||
map:'china',
|
||||
roam:false,//不开启缩放和平移
|
||||
zoom:1.23,//视角缩放比例
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
fontSize:'11',
|
||||
color: '#6C6C6C'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal:{
|
||||
borderColor: 'rgba(0, 0, 0, 0.2)'
|
||||
},
|
||||
emphasis:{
|
||||
areaColor: '#FF0000',//鼠标悬停区域颜色
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 0,
|
||||
shadowBlur: 20,
|
||||
borderWidth: 0,
|
||||
shadowColor: 'rgba(255, 255, 255, 0.5)'
|
||||
}
|
||||
}
|
||||
},
|
||||
series:[{
|
||||
name:'现有确诊',
|
||||
type:'map',
|
||||
map:'china',
|
||||
geoIndex: 0,
|
||||
roam: true,
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
textStyle:{
|
||||
color: 'rgb(0, 0, 0)',
|
||||
fontSize: 14
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[
|
||||
// {name:"南海诸岛",value:0},
|
||||
// {name: '北京', value: 97},
|
||||
// {name: '天津', value: 5},
|
||||
// {name: '上海', value: 30},
|
||||
// {name: '重庆', value: 2},
|
||||
// {name: '河北', value: 2},
|
||||
// {name: '河南', value: 1},
|
||||
// {name: '云南', value: 2},
|
||||
// {name: '辽宁', value: 4},
|
||||
// {name: '黑龙江', value: 13},
|
||||
// {name: '湖南', value: 0},
|
||||
// {name: '安徽', value: 0},
|
||||
// {name: '山东', value: 9},
|
||||
// {name: '新疆', value: 0},
|
||||
// {name: '江苏', value: 5},
|
||||
// {name: '浙江', value: 15},
|
||||
// {name: '江西', value: 1},
|
||||
// {name: '湖北', value: 8685},
|
||||
// {name: '广西', value: 3},
|
||||
// {name: '甘肃', value: 40},
|
||||
// {name: '山西', value: 1},
|
||||
// {name: '内蒙古', value: 1},
|
||||
// {name: '陕西', value: 7},
|
||||
// {name: '吉林', value: 0},
|
||||
// {name: '福建', value: 0},
|
||||
// {name: '贵州', value: 0},
|
||||
// {name: '广东', value: 49},
|
||||
// {name: '青海', value: 0},
|
||||
// {name: '西藏', value: 0},
|
||||
// {name: '四川', value: 17},
|
||||
// {name: '宁夏', value: 0},
|
||||
// {name: '海南', value: 1},
|
||||
// {name: '台湾', value: 54},
|
||||
// {name: '香港', value: 70},
|
||||
// {name: '澳门', value: 2}
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url:'/province_curconfirm',
|
||||
type:"GET",
|
||||
dataType:'json',
|
||||
async:false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
console.info('+++++ my_china.js')
|
||||
console.info(result)
|
||||
for(i=0,max=result.provinces.length; i<max; ++i) {
|
||||
option3.series[0].data.push({name:result.provinces[i], value:result.curConfirms[i]})
|
||||
}
|
||||
option3.title.subtext = '数据更新时间: ' + result.pub_date
|
||||
}
|
||||
});
|
||||
|
||||
myCharts3.setOption(option3);
|
@ -0,0 +1,107 @@
|
||||
var myCharts5 = echarts.init(document.getElementById('main5'));
|
||||
|
||||
var option5 = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "市名:{b}<br/>累计确诊:{c}"
|
||||
},
|
||||
textStyle: {color: '#FFFFFF'},
|
||||
title:{
|
||||
left: 'center',
|
||||
text: '广西疫情地图(累计确诊人数)',
|
||||
subtext: '数据更新时间: ',
|
||||
textStyle:{
|
||||
fontSize:20,
|
||||
align:"center"
|
||||
}
|
||||
},
|
||||
visualMap: {
|
||||
left: 'left',
|
||||
top: 'bottom',
|
||||
splitNumber: 7,
|
||||
pieces: [
|
||||
{value: 0},
|
||||
{min: 0, max: 9},
|
||||
{min: 10, max: 49},
|
||||
{min: 50, max: 99},
|
||||
{min: 100, max: 999},
|
||||
{min: 1000, max: 9999},
|
||||
{min: 10000}
|
||||
],
|
||||
textStyle: {
|
||||
color: "#B80909"
|
||||
},
|
||||
inRange: {
|
||||
color: ["#FFFFFF", "#FFE5DB", "#FFC4B3", "#FF9985", "#F57567", "#E64546", "#B80909"]
|
||||
},
|
||||
outOfRange: {
|
||||
color: "#FFFFFF"
|
||||
},
|
||||
show:true
|
||||
},
|
||||
geo:{
|
||||
map:'广西',
|
||||
roam:false,//不开启缩放和平移
|
||||
zoom:1.23,//视角缩放比例
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
fontSize:'11',
|
||||
color: '#6C6C6C'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal:{
|
||||
borderColor: 'rgba(0, 0, 0, 0.2)'
|
||||
},
|
||||
emphasis:{
|
||||
areaColor: '#FF0000',//鼠标悬停区域颜色
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 0,
|
||||
shadowBlur: 20,
|
||||
borderWidth: 0,
|
||||
shadowColor: 'rgba(255, 255, 255, 0.5)'
|
||||
}
|
||||
}
|
||||
},
|
||||
series:[{
|
||||
name:'现有确诊',
|
||||
type:'map',
|
||||
map:'广西',
|
||||
geoIndex: 0,
|
||||
roam: true,
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
textStyle:{
|
||||
color: 'rgb(0, 0, 0)',
|
||||
fontSize: 14
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[
|
||||
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url:'/guangxi_curconfirm',
|
||||
type:"GET",
|
||||
dataType:'json',
|
||||
async:false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
console.info('+++++ my_guangxi.js')
|
||||
console.info(result)
|
||||
for(i=0,max=result.provinces.length; i<max; ++i) {
|
||||
option5.series[0].data.push({name:result.provinces[i], value:result.curConfirms[i]})
|
||||
}
|
||||
option5.title.subtext = '数据更新时间: ' + result.pub_date
|
||||
}
|
||||
});
|
||||
|
||||
myCharts5.setOption(option5);
|
@ -0,0 +1,108 @@
|
||||
var myCharts4 = echarts.init(document.getElementById('main4'));
|
||||
|
||||
var option4 = {
|
||||
backgroundColor: 'rgba(0, 178, 255, 0.89)',
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "国家:{b}<br/>确诊:{c}"
|
||||
},
|
||||
textStyle: {color: '#FFFFFF'},
|
||||
title:{
|
||||
left: 'center',
|
||||
text: '世界疫情地图(现有确诊人数)',
|
||||
subtext: '数据更新时间: ',
|
||||
textStyle:{
|
||||
fontSize:20,
|
||||
align:"center"
|
||||
}
|
||||
},
|
||||
visualMap: {
|
||||
left: 'left',
|
||||
top: 'bottom',
|
||||
splitNumber: 7,
|
||||
pieces: [
|
||||
{value: 0},
|
||||
{min: 0, max: 9},
|
||||
{min: 10, max: 49},
|
||||
{min: 50, max: 99},
|
||||
{min: 100, max: 999},
|
||||
{min: 1000, max: 9999},
|
||||
{min: 10000}
|
||||
],
|
||||
textStyle: {
|
||||
color: "#B80909"
|
||||
},
|
||||
inRange: {
|
||||
color: ["#FFFFFF", "#FFE5DB", "#FFC4B3", "#FF9985", "#F57567", "#E64546", "#B80909"]
|
||||
},
|
||||
outOfRange: {
|
||||
color: "#FFFFFF"
|
||||
},
|
||||
show:true
|
||||
},
|
||||
geo:{
|
||||
map:'world',
|
||||
roam:false,//不开启缩放和平移
|
||||
zoom:1.23,//视角缩放比例
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
fontSize:'11',
|
||||
color: '#6C6C6C'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal:{
|
||||
borderColor: 'rgba(0, 0, 0, 0.2)'
|
||||
},
|
||||
emphasis:{
|
||||
areaColor: '#FF0000',//鼠标悬停区域颜色
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 0,
|
||||
shadowBlur: 20,
|
||||
borderWidth: 0,
|
||||
shadowColor: 'rgba(255, 255, 255, 0.5)'
|
||||
}
|
||||
}
|
||||
},
|
||||
series:[{
|
||||
name:'现有确诊',
|
||||
type:'map',
|
||||
map:'world',
|
||||
geoIndex: 0,
|
||||
roam: true,
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
textStyle:{
|
||||
color: 'rgb(0, 0, 0)',
|
||||
fontSize: 14
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[
|
||||
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url:'/country_curconfirm',
|
||||
type:"GET",
|
||||
dataType:'json',
|
||||
async:false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
console.info('+++++ my_world.js')
|
||||
console.info(result)
|
||||
for(i=0,max=result.provinces.length; i<max; ++i) {
|
||||
option4.series[0].data.push({name:result.provinces[i], value:result.curConfirms[i]})
|
||||
}
|
||||
option4.title.subtext = '数据更新时间: ' + result.pub_date
|
||||
}
|
||||
});
|
||||
|
||||
myCharts4.setOption(option4);
|
@ -0,0 +1,107 @@
|
||||
var myCharts6 = echarts.init(document.getElementById('main6'));
|
||||
|
||||
var option6 = {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "市名:{b}<br/>累计治愈:{c}"
|
||||
},
|
||||
textStyle: {color: '#FFFFFF'},
|
||||
title:{
|
||||
left: 'center',
|
||||
text: '中原疫情地图(累计治愈人数)',
|
||||
subtext: '数据更新时间: ',
|
||||
textStyle:{
|
||||
fontSize:20,
|
||||
align:"center"
|
||||
}
|
||||
},
|
||||
visualMap: {
|
||||
left: 'left',
|
||||
top: 'bottom',
|
||||
splitNumber: 7,
|
||||
pieces: [
|
||||
{value: 0},
|
||||
{min: 0, max: 9},
|
||||
{min: 10, max: 49},
|
||||
{min: 50, max: 99},
|
||||
{min: 100, max: 999},
|
||||
{min: 1000, max: 9999},
|
||||
{min: 10000}
|
||||
],
|
||||
textStyle: {
|
||||
color: "rgba(21, 255, 0, 1)"
|
||||
},
|
||||
inRange: {
|
||||
color: ["rgba(21, 255, 0, 0)", "rgba(21, 255, 0, 0.2)", "rgba(21, 255, 0, 0.4)", "rgba(21, 255, 0, 0.5)", "rgba(21, 255, 0, 0.6)", "rgba(21, 255, 0, 0.8)", "rgba(21, 255, 0, 1)"]
|
||||
},
|
||||
outOfRange: {
|
||||
color: "#FFFFFF"
|
||||
},
|
||||
show:true
|
||||
},
|
||||
geo:{
|
||||
map:'河南',
|
||||
roam:false,//不开启缩放和平移
|
||||
zoom:1.23,//视角缩放比例
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
fontSize:'11',
|
||||
color: '#6C6C6C'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal:{
|
||||
borderColor: 'rgba(0, 0, 0, 0.2)'
|
||||
},
|
||||
emphasis:{
|
||||
areaColor: 'rgba(21, 255, 0, 1)',//鼠标悬停区域颜色
|
||||
shadowOffsetX: 0,
|
||||
shadowOffsetY: 0,
|
||||
shadowBlur: 20,
|
||||
borderWidth: 0,
|
||||
shadowColor: 'rgba(255, 255, 255, 0.5)'
|
||||
}
|
||||
}
|
||||
},
|
||||
series:[{
|
||||
name:'现有确诊',
|
||||
type:'map',
|
||||
map:'河南',
|
||||
geoIndex: 0,
|
||||
roam: true,
|
||||
label: {
|
||||
normal: {
|
||||
show: true,
|
||||
textStyle:{
|
||||
color: 'rgb(0, 0, 0)',
|
||||
fontSize: 14
|
||||
}
|
||||
}
|
||||
},
|
||||
data:[
|
||||
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url:'/henan_curconfirm',
|
||||
type:"GET",
|
||||
dataType:'json',
|
||||
async:false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
console.info('+++++ myhome.js')
|
||||
console.info(result)
|
||||
for(i=0,max=result.provinces.length; i<max; ++i) {
|
||||
option6.series[0].data.push({name:result.provinces[i], value:result.curConfirms[i]})
|
||||
}
|
||||
option6.title.subtext = '数据更新时间: ' + result.pub_date
|
||||
}
|
||||
});
|
||||
|
||||
myCharts6.setOption(option6);
|
@ -0,0 +1,55 @@
|
||||
var myCharts8 = echarts.init(document.getElementById("main8"));
|
||||
var option8 = {
|
||||
title: {
|
||||
text: '全国各省现有确诊人数top5具体数据比较',
|
||||
subtext: '',
|
||||
left: 'center',
|
||||
textStyle:{
|
||||
color:'rgba(255, 0, 0, 0)',
|
||||
fontFamily:'微软雅黑'
|
||||
}
|
||||
},
|
||||
legend: {},
|
||||
tooltip: {},
|
||||
dataset: {
|
||||
source: [['省份', '现存确诊', '累计确诊', '累计治愈'],
|
||||
['Matcha Latte', 43.3, 85.8, 93.7],
|
||||
['Milk Tea', 83.1, 73.4, 55.1],
|
||||
['Cheese Cocoa', 86.4, 65.2, 82.5],
|
||||
['Walnut Brownie', 72.4, 53.9, 39.1],
|
||||
['a', 72.4, 53.9, 39.1]]
|
||||
},
|
||||
xAxis: {type: 'category'},
|
||||
yAxis: {
|
||||
},
|
||||
// Declare several bar series, each will be mapped
|
||||
// to a column of dataset.source by default.
|
||||
series: [
|
||||
{type: 'bar'},
|
||||
{type: 'bar'},
|
||||
{type: 'bar'}
|
||||
]
|
||||
};
|
||||
// 向后台发起请求,获取数据
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type:"GET",
|
||||
url:"/province_top5",
|
||||
data: null,
|
||||
dataType : "json",
|
||||
async: false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
option8.title.subtext = "数据更新时间: " + result.pub_date
|
||||
for(i=0; i<5; ++i) {
|
||||
option8.dataset.source[i+1][0]=result.privinces[i]
|
||||
option8.dataset.source[i+1][1]=result.curConfirms[i]
|
||||
option8.dataset.source[i+1][2]=result.confirmcount[i]
|
||||
option8.dataset.source[i+1][3]=result.curecount[i]
|
||||
}
|
||||
console.info(result)
|
||||
}
|
||||
});
|
||||
myCharts8.setOption(option8);
|
@ -0,0 +1,64 @@
|
||||
var myCharts2 = echarts.init(document.getElementById("main2"));
|
||||
|
||||
var option2 = {
|
||||
title: {
|
||||
text: '现有确诊人数最多的十个国家',
|
||||
subtext: '',
|
||||
left: 'center',
|
||||
textStyle:{
|
||||
fontFamily:'微软雅黑'
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||
},
|
||||
legend: {
|
||||
type: 'scroll',
|
||||
orient: 'vertical',
|
||||
right: 10,
|
||||
top: 20,
|
||||
bottom: 20,
|
||||
data: []
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '国家',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['40%', '50%'],
|
||||
data: [],
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// 向后台发起请求,获取数据
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type:"GET",
|
||||
url:"/country_topn_curconfirm",
|
||||
data: null,
|
||||
dataType : "json",
|
||||
async: false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败");
|
||||
},
|
||||
success: function(result) {
|
||||
// pub_date, privinces, curConfirms
|
||||
option2.title.subtext = "数据更新时间: " + result.pub_date
|
||||
for(i=0; i<result.privinces.length; ++i) {
|
||||
option2.legend.data.push(result.privinces[i])
|
||||
option2.series[0].data.push({name:result.privinces[i], value:result.curConfirms[i]})
|
||||
}
|
||||
console.info(result)
|
||||
}
|
||||
});
|
||||
|
||||
myCharts2.setOption(option2);
|
@ -0,0 +1,60 @@
|
||||
var myCharts9 = echarts.init(document.getElementById("main9"));
|
||||
var option9 = {
|
||||
title: {
|
||||
text: '全球现有确诊人数top5具体数据比较',
|
||||
subtext: '',
|
||||
left: 'center',
|
||||
textStyle:{
|
||||
color:'rgba(255, 0, 0, 0)',
|
||||
fontFamily:'微软雅黑'
|
||||
}
|
||||
},
|
||||
legend: {},
|
||||
tooltip: {},
|
||||
dataset: {
|
||||
source: [['国家', '现存确诊', '累计确诊', '累计治愈'],
|
||||
['Matcha Late', 43.3, 85.8, 93.7],
|
||||
['Milk Te2a', 83.1, 73.4, 55.1],
|
||||
['Cheese C3ocoa', 86.4, 65.2, 82.5],
|
||||
['Walnut Br4ownie', 72.4, 53.9, 39.1],
|
||||
['Matcha La5tte', 43.3, 85.8, 93.7],
|
||||
['Milk Te7a', 83.1, 73.4, 55.1],
|
||||
['Cheese C9ocoa', 86.4, 65.2, 82.5],
|
||||
['Walnut Br0ownie', 72.4, 53.9, 39.1],
|
||||
['Cheese Coc-oa', 86.4, 65.2, 82.5],
|
||||
['a', 72.4, 53.9, 39.1]]
|
||||
},
|
||||
xAxis: {type: 'category'},
|
||||
yAxis: {
|
||||
},
|
||||
// Declare several bar series, each will be mapped
|
||||
// to a column of dataset.source by default.
|
||||
series: [
|
||||
{type: 'bar'},
|
||||
{type: 'bar'},
|
||||
{type: 'bar'}
|
||||
]
|
||||
};
|
||||
// 向后台发起请求,获取数据
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type:"GET",
|
||||
url:"/country_top10",
|
||||
data: null,
|
||||
dataType : "json",
|
||||
async: false,
|
||||
error: function(request) {
|
||||
alert("发送请求失败!");
|
||||
},
|
||||
success: function(result) {
|
||||
option9.title.subtext = "数据更新时间: " + result.pub_date
|
||||
for(i=0; i<10; ++i) {
|
||||
option9.dataset.source[i+1][0]=result.privinces[i]
|
||||
option9.dataset.source[i+1][1]=result.curConfirms[i]
|
||||
option9.dataset.source[i+1][2]=result.confirmcount[i]
|
||||
option9.dataset.source[i+1][3]=result.curecount[i]
|
||||
}
|
||||
console.info(result)
|
||||
}
|
||||
});
|
||||
myCharts9.setOption(option9);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue