From ec550dbaab2743958b713c9077295cbe08f37826 Mon Sep 17 00:00:00 2001 From: yangxudongll <1593744164@qq.com> Date: Wed, 12 Aug 2020 18:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E5=A4=96=E7=96=AB=E6=83=85=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__pycache__/models.cpython-36.pyc | Bin 3089 -> 3405 bytes .../新冠疫情/hello.py | 7 +- .../新冠疫情/models.py | 2 +- .../新冠疫情/templates/foreign.html | 73 ++++++++++++++++-- 数据存储/.idea/workspace.xml | 21 ++--- 数据存储/DataFrame.py | 26 ++----- .../__pycache__/DataFrame.cpython-36.pyc | Bin 8722 -> 8260 bytes 7 files changed, 85 insertions(+), 44 deletions(-) diff --git a/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc b/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc index 22c4966c28639ff29f5afc60e09ba224f7d8f14e..7ea1016c023579afffcd0d38566c1b210a5a5541 100644 GIT binary patch delta 201 zcmbOzaaM}Un3tE!a+7hqC-+3IV#bt-b+J4tVl50&yeZfXcyfMTT4qshYKlTiYH_kcPG)XqiGrcQ3z#>ijhMCaZC$Gb&Gh i$Spp30XLVF7*G#T3nvE)2O9?nu!Auh2m9nh-2MQjl{2FN delta 77 zcmX>rHBo}gn3tEUuGu(VfomdHF=Nccx>%NA22HVz&t15f{WN(eNAsjlR^%0)e2a%m bLWF^VfrF8QlY@nWjROSO!I*9GKOTPo)Oio- diff --git a/数据分析和可视化/新冠疫情/hello.py b/数据分析和可视化/新冠疫情/hello.py index a3ed7ef..1bebf49 100644 --- a/数据分析和可视化/新冠疫情/hello.py +++ b/数据分析和可视化/新冠疫情/hello.py @@ -52,7 +52,8 @@ def GlobalInfomation(): country.append("中国") confirmed = [x[0] for x in results] confirmed.append(db.searchSummaryChina('2020-08-10')[0][1]) - + top10data=db.query_top10(nowtime) + print(top10data) summaryData=db.querySummaryForeign(nowtime)[0] data=jsonify(country=country, confirmed=confirmed,died=[x[1] for x in results], crued=[x[2] for x in results],curConfirm=[x[4] for x in results], @@ -60,7 +61,9 @@ def GlobalInfomation(): TotalConfirmed=summaryData[1],TotalCurConfirm=summaryData[2], TotalconfirmRelative=summaryData[3],TotalCrued=summaryData[4], TotalDied=summaryData[6],TotalDiedRelative=summaryData[7], - TotalCruedRelative=summaryData[5],TotalcurConfirmRelative=summaryData[9]) + TotalCruedRelative=summaryData[5],TotalcurConfirmRelative=summaryData[9], + top10confirmed=[x[0] for x in top10data],top10curconfirm=[x[1] for x in top10data], + top10country=[x[2] for x in top10data]) return data @app.route("/") diff --git a/数据分析和可视化/新冠疫情/models.py b/数据分析和可视化/新冠疫情/models.py index 2c717e3..7281eb6 100644 --- a/数据分析和可视化/新冠疫情/models.py +++ b/数据分析和可视化/新冠疫情/models.py @@ -76,7 +76,7 @@ class GetFromDB(): #新增国家top10 def query_top10(self,date): thedate=date+"%" - sql='select confirmed,confirmedRelative from ForeignCountry where pub_date like "%s" order by confirmed desc limit 10'%(thedate) + sql='select confirmed,confirmedRelative,country from ForeignCountry where pub_date like "%s" order by confirmed desc limit 10'%(thedate) self.cursor.execute(sql) return self.cursor.fetchall() diff --git a/数据分析和可视化/新冠疫情/templates/foreign.html b/数据分析和可视化/新冠疫情/templates/foreign.html index 34416a9..b108022 100644 --- a/数据分析和可视化/新冠疫情/templates/foreign.html +++ b/数据分析和可视化/新冠疫情/templates/foreign.html @@ -115,8 +115,8 @@
- 当前确诊人数最多的5个省份 -
+ 当前确诊人数最多的10个国家 +
@@ -164,12 +164,12 @@ //在国内,国外疫情,防护知识间切换 -console.log("+++++++++++++++++++++++++++++"); + var ospan = document.querySelectorAll('.middle_con .wrap .tabs .tabs_wrap span'); -console.log(ospan.length); + var num_op = 0; var tabs_list = document.querySelectorAll('.middle_con .wrap .tabs_content .tabs_list'); -console.log(tabs_list.length); + tabs_list[0].style.display = 'block'; for (var i = 0; i < ospan.length; i++) { ospan[i].index = i; @@ -429,7 +429,7 @@ dataRange:{ }; - +//表格填充 function eachchina(province,confirmed,curconfirm,died) { var str = ''; if (province.length!=0) { @@ -450,6 +450,54 @@ function eachchina(province,confirmed,curconfirm,died) { } } +//绘制世界top10确诊国家 +var top10chart=echarts.init(document.getElementById('top10chart')); +var top10option={ + title:{ + text:'确诊top10', + left:'20px', + + }, + tooltip:{ + trigger:"axis", + }, + legend:{ + itemWith:15, + itemHeight:15, + data:['累计确诊','新增确诊'] + }, + xAxis:{ + type:'category', + data:[], + splitLine:{ + show:true, + }, + axisLabel:{interval: 0} + }, + yAxis:{ + splitLine:{ + show:false, + } + }, + series:[{ + name:'累计确诊', + type:'bar', + stack:'累计', + data:[], + + },{ + name:'新增确诊', + type:'bar', + stack:'新增', + data:[], + + } + + ] +}; + + + $.ajax({ cache:false, type:'POST', @@ -472,8 +520,7 @@ $.ajax({ confirmed=results.confirmed; foreignName=results.country; - console.log(confirmed); - console.log(foreignName); + for(i=0;i - - - - -