diff --git a/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc b/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc index fba0d12..2e4b59f 100644 Binary files a/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc and b/数据分析和可视化/新冠疫情/__pycache__/models.cpython-36.pyc differ diff --git a/数据分析和可视化/新冠疫情/hello.py b/数据分析和可视化/新冠疫情/hello.py index aa360f7..3b09917 100644 --- a/数据分析和可视化/新冠疫情/hello.py +++ b/数据分析和可视化/新冠疫情/hello.py @@ -9,6 +9,7 @@ def query_province_topn(): db=GetFromDB() results=db.query_province_topn('2020-08-07',5) data=jsonify(pub_dates=str(results[0][2]),areas=[x[0] for x in results],curcofirms=[x[1] for x in results]) + return data @app.route("/chinaInfo/",methods=['POST']) @@ -25,7 +26,11 @@ def GlobalInfomation(): db = GetFromDB() results=db.searchForeignInformation('2020-08-10') #由于查询到的数据中没有中国的信息,因此需要查询中国的信息加到世界信息中 - data=jsonify(country=[x[3] for x in results], confirmed=[x[0] for x in results],died=[x[1] for x in results], + country = [x[3] for x in results] + country.append("中国") + confirmed = [x[0] for x in results] + confirmed.append(db.searchSummaryChina('2020-08-10')[0][1]) + 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],confirmedRelative=[x[5] for x in results]) return data diff --git a/数据分析和可视化/新冠疫情/models.py b/数据分析和可视化/新冠疫情/models.py index 7767624..5b94994 100644 --- a/数据分析和可视化/新冠疫情/models.py +++ b/数据分析和可视化/新冠疫情/models.py @@ -42,6 +42,14 @@ class GetFromDB(): thedate = date + "%" sql='select confirmed,died,crued,country,curConfirm,confirmedRelative from ForeignCountry where pub_date like "%s"'%(thedate) self.cursor.execute(sql) + return self.cursor.fetchall() + + + #查询国内疫情概况 + def searchSummaryChina(self,date): + thedate = date + "%" + sql='select * from InsideChina where updateTime like "%s"'%(thedate) + self.cursor.execute(sql) + return self.cursor.fetchall() - return self.cursor.fetchall() \ No newline at end of file diff --git a/数据分析和可视化/新冠疫情/templates/global.html b/数据分析和可视化/新冠疫情/templates/global.html index 9ee445f..bc485d4 100644 --- a/数据分析和可视化/新冠疫情/templates/global.html +++ b/数据分析和可视化/新冠疫情/templates/global.html @@ -20,7 +20,7 @@ -
+
@@ -33,27 +33,33 @@ subtitle:'2020-08-10', left: 'center', top: 'top' - }, - /* tooltip: { - trigger: 'item', - formatter: function (params) { - var value = (params.value + '').split('.'); - value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,') - + '.' + value[1]; - return params.seriesName + '
' + params.name + ' : ' + value; - } - },*/ - + }, + tooltip: { + trigger: 'item', + transitionDuration: 0.2, + formatter: function (params) { + var value = params.value; + return "确诊人数:"+value; + } + }, +dataRange:{ + x:'left', + y:'bottom', + splitList:[ + {start:10000000,label:'>1000000',color:'#990000'}, + {start:1000000,end:10000000,label:'1000000-1000000',color:'#FF6600'}, + {start:100000,end:1000000,label:'100000-1000000',color:'#FF6699'}, + {start:10000,end:100000,label:'10000-100000',color:'#FF99CC'}, + {start:1000,end:10000,label:'1000-10000',color:'#FFCC00'}, + {start:100,end:1000,label:'100-1000',color:'#FFFF00'}, + {start:0,end:100,label:'0-100',color:'#FFFFCC'}, + ], + textStyle:{ + color:'#3899FF' + }, + selectMode:'false' +}, - visualMap: { - min: 0, - max: 11000000, - text:['High','Low'], - realtime: false, - calculable: true, - inRange: {color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026'] - }, - }, series: [ { name: 'World Population (2010)', @@ -278,7 +284,7 @@ } } }); - myChart.setOption(option); + myChart.setOption(option); diff --git a/数据存储/.idea/workspace.xml b/数据存储/.idea/workspace.xml index 84858ea..1202c64 100644 --- a/数据存储/.idea/workspace.xml +++ b/数据存储/.idea/workspace.xml @@ -1,13 +1,7 @@ - - - - - - - +