結對第二次作業——某次疫情統計可視化的實現


結對第二次作業

這個作業屬於哪個課程 2020春|W班(福州大學)
這個作業要求在哪里 某次疫情統計可視化的實現
結對學號 221701123 & 221701139
這個作業的目標 實現某次疫情統計的可視化
作業正文 https://www.cnblogs.com/cybersa/p/12493648.html
其他參考文獻 csdn,bootstrap,jsp,爬蟲等等

倉庫鏈接&項目地址&代碼規范

github倉庫鏈接:https://github.com/HongJieBin/InfectStatisticWeb

代碼規范鏈接:https://github.com/HongJieBin/InfectStatisticWeb/blob/dev/codestyle.md

項目地址: http://123.57.3.237:8080/InfectStatisticWeb/include/statistics.jsp(服務器好像在過十幾天就到期了)

項目功能演示

基本功能

實現疫情地圖的可視化及疫情趨勢圖的可視化

附加功能

實現疫情地圖的提取和謠言粉碎消息的提取

 

結對討論過程描述

開始的開放技術和版本討論

中間問題的解決

過程討論

描述設計實現過程

  1. 首先是對技術的要求,開始我們達成了用jsp框架開發的共識之后,新建了本次作業的github項目地址及技術版本,因為我們原型制作時采用的時app形式的原型,本來打算改原型的相關界面,但經過了一番討論后,還是覺得可以直接用JAVA EE實現類似手機app形式的前端頁面和交互,便開始了本次的作業。

  2. 前端采用bootstrap框架,后端的數據主要利用網上爬蟲的數據接口進行數據的傳入。

  3. 主要功能的實現地圖和圖表采用Echart實現,數據傳入使用數據接口api及json文件傳入。

功能結構

 

關鍵代碼

地圖實現

chart.setOption({
title: {
  text: '全國地圖',
  subtext: '該頁面的數據僅供參考',
},
tooltip: {
trigger: 'item',
formatter:function(params){
return params.name+'<br />'+'確診人數:'+params['data']['value']+'<br />'+'死亡人數:'
      +params['data']['dead']+'<br />'+'治愈人數:'+params['data']['heal'];
  }//數據格式化
},
toolbox: {
  show: true,
  orient: 'vertical',
  left: 'right',
  top: 'center',
  feature: {
      dataView: {readOnly: false},
      restore: {},
      saveAsImage: {}
  }
},
visualMap: {
type: 'piecewise',
pieces: [
{ min: 1000, max: 1000000, label: '大於等於1000人', color: '#372a28' },
{ min: 500, max: 999, label: '確診500-999人', color: '#4e160f' },
{ min: 100, max: 499, label: '確診100-499人', color: '#974236' },
{ min: 10, max: 99, label: '確診10-99人', color: '#ee7263' },
{ min: 1, max: 9, label: '確診1-9人', color: '#f5bba7' },
],
color: ['#E0022B', '#E09107', '#A3E00B']
},
series: [{
name: '累積確診',
  type: 'map',
  map: 'china',
  label:{
      show: true
  },
}
]
});

前端頁面代碼展示

<div id="wapper" style="width: 360px;height: 660px;">
<!-- 頭部區域 -->
<div id="header" style="width: 360px;height: 60px;">
<button type="button" class="btn btn-default" aria-label="Justify" style="height: 60px;width: 40px;
border-color: #6200EE;">
<span class="glyphicon glyphicon-align-left popup-icon" aria-hidden="true" style="font-size: 30px;color: white;"></span>
</button>
<span style="font-size: 20px;color: white;line-height: 20px;margin-left: 10px;">疫情統計</span>
<button type="button" class="btn btn-default" aria-label="Justify" style="height: 60px;width: 40px;
border-color: #6200EE;float: right;margin-right: 10px;">
<span class="glyphicon glyphicon-option-vertical" aria-hidden="true" style="font-size: 30px;color: white;"></span>
</button>
</div>

<!-- 彈出框 -->
<div id="popup">
<p style="height: 52px;width: 212px;font-size: 20px;margin: 10px 0px;">疫情</p>
<ul class="list-group blogroll">
<li class="list-group-item"><a href="statistics.jsp">疫情統計</a></li>
<li class="list-group-item"><a href="tendency.jsp">疫情趨勢</a></li>
<li class="list-group-item"><a href="news.jsp">疫情新聞</a></li>
<li class="list-group-item"><a href="rumor-broken.jsp">謠言粉碎機</a></li>
<li class="list-group-item"><a href="medical-information.jsp">醫療信息查詢</a></li>
<li class="list-group-item"><a href="contribution.jsp">奉獻</a></li>
</ul>
</div>

<!-- 身體區域 -->
<div id="body" style="width: 360px;height: 546px;">
<!-- 按鈕+實時數據標簽+橫線 -->
<div id="info-header">
<button type="button" class="btn btn-primary btn-lg btn-block" id="static-button">疫情統計</button>
<div id="update_time" style="margin: 0 auto;border-radius: 15px;width: 120px;height: 24px;border: 1px solid #009999;
font-size: 12px;line-height: 24px;"></div>
<div id="info-header-line">
<div></div>
<div></div>
</div>
</div>
<!-- 顯示信息區域 -->
<div id="info" style="width: 360px; height: 150px;position: relative;">

<!-- 顯示6個數據項 -->
<div class="info-block">
<h1>累計確診</h1>
<p id="confirm" style="color: #D9001B;"></p>
<p id="confirmAdd"></p>
</div>
<div class="info-block">
<h1>現存確診</h1>
<p id="nowConfirm" style="color: #FF6A57;"></p>
<p id="nowconfirmAdd"></p>
</div>
<div class="info-block">
<h1>現存重症</h1>
<p id="nowSevere" style="color: #476DA0;">51325</p>
<p id="SevereAdd"></p>
</div>
<div class="info-block">
<h1>現存疑似</h1>
<p id="suspect" style="color: #02A7F0;">51325</p>
<p id="suspectAdd"></p>
</div>
<div class="info-block">
<h1>累計死亡</h1>
<p id="dead" style="color: #A30014;">51325</p>
<p id="deadAdd"></p>
</div>
<div class="info-block">
<h1>累計治愈</h1>
<p id="heal" style="color: #70B603;">51325</p>
<p id="healAdd"></p>
</div>

</div>    
<!-- 下橫線+切換按鈕 -->
<div id="info-buttom">
<div id="info-buttom-line">
<div></div>
<div></div>
</div>
<!-- <button type="button" class="btn btn-primary">現存確診</button> -->
<button type="button" class="btn btn-primary">全國主要疫情信息</button>
</div>
<!-- 圖表區域 -->
<div id="main" style="width: 360px;height: 250px;margin: 0 auto;"></div>
</div>

<!-- 底欄 -->
<div id="footer" class="footer" style="width: 360px;height: 54px;">
<p class="left">如果你有意支持武漢!!&nbsp;&nbsp;&nbsp;&nbsp;請點:</p>
<p class="right">一定愛心</p>
</div>
</div>

數據提取與處理

XHR = new XMLHttpRequest();
XHR.open('GET', 'http://api.tianapi.com/txapi/rumour/index?&key=dcd2cc2b1d430288b8c21a3647b375ba&num=50&rand=1', true);
XHR.send();
XHR.onreadystatechange = function() {
var data={};
if (XHR.readyState === 4 && XHR.status === 200) {

// 從天行數據那獲取數據之后解碼為JSON對象。
getText = JSON.parse(XHR.responseText);
data=getText.newslist;

}
var titles = document.getElementsByClassName("title");
var contents = document.getElementsByClassName("content");
var sources = document.getElementsByClassName("source");
for(var i=0;i<titles.length;i++) {
  titles[i].innerHTML=data[i].title.substring(0,10)+"....";
  contents[i].innerHTML=data[i].desc;
  sources[i].innerHTML=data[i].author;
}
}

 

閱讀《構建之法》及對本次結對的心路歷程與收獲

構建之法閱讀,首先體會到的時書籍里面說得差異導致團隊開發過程中產生一些小問題,可能會出現不同步的情況,只有了解對方的優勢和性格后,能有效的提高團隊開發的效率。同時,對git的使用和github進行代碼管理雖然中間有出現過一些沖突的情形,但隊友都積極溝通,很快也得到了解決。經過構建之法的學習和兩次結對作業的合作,提高了在結對編程時解決問題和互相合作的能力,也得到了一定的鍛煉。

221701123 對於隊友的評價,我的隊友很強,中間關於爬蟲的問題我也向他請教了一下,他學習能力很強,他利用bootstrap實現了大體界面的開發,而我則只是定制echart放入和將數據放入其中而已,我還有很多需要向他學習的地方。

221701139 先說一下這次的開發過程吧,這次的開發過程主要麻煩在於技術選定,因為當初沒有考慮到設計的原型要實現,所以設計了手機app的原型,但事實上關於手機app的設計我和我的組員都不熟悉,如果這次重新設計原型就多此一舉了,所以只能在以下功能上進行簡化以便實現,還有一點就是雖然上一次作業就是結對作業,但是結對使用github確實第一次,整個過程中出現了很多意想不到的問題,比如網絡問題導致github訪問很慢,push也出現問題,pull request時出現merge沖突的問題,導致程序版本不能很好的統一,還有一點就是服務器部署的時候,訪問了好幾次都不行但是某次關閉tomcat的時候出現了錯誤,但是之后就可以訪問了.這樣的小問題還是很煩人的.

收獲就是對於git真正的用處了解的更深了,不同的分支,代碼的合並這些功能都是手動管理不能實現的.還有就是開發項目的時候選擇自己熟悉的技術才能比較好的開發項目

最后自己的能力還是不足,不能很好的完成任務,感嘆自己怎么這么弱,還需要堅持學習

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM