Showing
5 changed files
with
1211 additions
and
0 deletions
views/page/page.py
0 → 100644
| 1 | +from flask import Flask,session,render_template,redirect,Blueprint,request | ||
| 2 | +from snownlp import SnowNLP | ||
| 3 | +from utils.getHomePageData import * | ||
| 4 | +from utils.getHotWordPageData import * | ||
| 5 | +from utils.getTableData import * | ||
| 6 | +from utils.getPublicData import getAllHotWords | ||
| 7 | +from utils.getEchartsData import * | ||
| 8 | +pb = Blueprint('page',__name__,url_prefix='/page',template_folder='templates') | ||
| 9 | + | ||
| 10 | +@pb.route('/home') | ||
| 11 | +def home(): | ||
| 12 | + username = session.get('username') | ||
| 13 | + articleLenMax,likeCountMaxAuthorName,cityMax = getHomeTagsData() | ||
| 14 | + commentsLikeCountTopFore = getHomeCommentsLikeCountTopFore() | ||
| 15 | + xData,yData = getHomeArticleCreatedAtChart() | ||
| 16 | + typeChart = getHomeTypeChart() | ||
| 17 | + createAtChart = getHomeCommentCreatedChart() | ||
| 18 | + # getUserNameWordCloud() | ||
| 19 | + return render_template('index.html', | ||
| 20 | + username=username, | ||
| 21 | + articleLenMax=articleLenMax, | ||
| 22 | + likeCountMaxAuthorName=likeCountMaxAuthorName, | ||
| 23 | + cityMax=cityMax, | ||
| 24 | + commentsLikeCountTopFore=commentsLikeCountTopFore, | ||
| 25 | + xData=xData, | ||
| 26 | + yData=yData, | ||
| 27 | + typeChart=typeChart, | ||
| 28 | + createAtChart=createAtChart | ||
| 29 | + ) | ||
| 30 | + | ||
| 31 | +@pb.route('/hotWord') | ||
| 32 | +def hotWord(): | ||
| 33 | + username = session.get('username') | ||
| 34 | + hotWordList = getAllHotWords() | ||
| 35 | + defaultHotWord = hotWordList[0][0] | ||
| 36 | + if request.args.get('hotWord'):defaultHotWord = request.args.get('hotWord') | ||
| 37 | + hotWordLen = getHotWordLen(defaultHotWord) | ||
| 38 | + xData,yData = getHotWordPageCreatedAtCharData(defaultHotWord) | ||
| 39 | + sentences = '' | ||
| 40 | + value = SnowNLP(defaultHotWord).sentiments | ||
| 41 | + if value == 0.5: | ||
| 42 | + sentences = '中性' | ||
| 43 | + elif value > 0.5: | ||
| 44 | + sentences = '正面' | ||
| 45 | + elif value < 0.5: | ||
| 46 | + sentences = '负面' | ||
| 47 | + | ||
| 48 | + comments = getCommentFilterData(defaultHotWord) | ||
| 49 | + return render_template('hotWord.html', | ||
| 50 | + username=username, | ||
| 51 | + hotWordList=hotWordList, | ||
| 52 | + defaultHotWord=defaultHotWord, | ||
| 53 | + hotWordLen=hotWordLen, | ||
| 54 | + sentences=sentences, | ||
| 55 | + xData=xData, | ||
| 56 | + yData=yData, | ||
| 57 | + comments=comments | ||
| 58 | + ) | ||
| 59 | + | ||
| 60 | +@pb.route('/tableData') | ||
| 61 | +def tableData(): | ||
| 62 | + username = session.get('username') | ||
| 63 | + defaultFlag = False | ||
| 64 | + if request.args.get('flag'):defaultFlag = True | ||
| 65 | + tableData = getTableDataList(defaultFlag) | ||
| 66 | + return render_template('tableData.html', | ||
| 67 | + username=username, | ||
| 68 | + tableData=tableData, | ||
| 69 | + defaultFlag=defaultFlag | ||
| 70 | + ) | ||
| 71 | + | ||
| 72 | +@pb.route('/articleChar') | ||
| 73 | +def articleChar(): | ||
| 74 | + username = session.get('username') | ||
| 75 | + typeList = getTypeList() | ||
| 76 | + defaultType = typeList[0] | ||
| 77 | + if request.args.get('type'): defaultType = request.args.get('type') | ||
| 78 | + xData,yData = getArticleCharLikeCount(defaultType) | ||
| 79 | + x1Data,y1Data = getArticleCharCommentsLen(defaultType) | ||
| 80 | + x2Data,y2Data = getArticleCharRepotsLen(defaultType) | ||
| 81 | + return render_template('articleChar.html', | ||
| 82 | + username=username, | ||
| 83 | + typeList=typeList, | ||
| 84 | + defaultType=defaultType, | ||
| 85 | + xData=xData, | ||
| 86 | + yData=yData, | ||
| 87 | + x1Data=x1Data, | ||
| 88 | + y1Data=y1Data, | ||
| 89 | + x2Data=x2Data, | ||
| 90 | + y2Data=y2Data | ||
| 91 | + ) | ||
| 92 | + | ||
| 93 | +@pb.route('/ipChar') | ||
| 94 | +def ipChar(): | ||
| 95 | + username = session.get('username') | ||
| 96 | + articleRegionData = getIPCharByArticleRegion() | ||
| 97 | + commentRegionData = getIPCharByCommentsRegion() | ||
| 98 | + return render_template('ipChar.html', | ||
| 99 | + username=username, | ||
| 100 | + articleRegionData=articleRegionData, | ||
| 101 | + commentRegionData=commentRegionData | ||
| 102 | + ) | ||
| 103 | + | ||
| 104 | +@pb.route('/commentChar') | ||
| 105 | +def commentChar(): | ||
| 106 | + username = session.get('username') | ||
| 107 | + xData,yData = getCommentCharDataOne() | ||
| 108 | + genderPieData = getCommentCharDataTwo() | ||
| 109 | + return render_template('commentChar.html', | ||
| 110 | + username=username, | ||
| 111 | + xData=xData, | ||
| 112 | + yData=yData, | ||
| 113 | + genderPieData=genderPieData | ||
| 114 | + ) | ||
| 115 | + | ||
| 116 | +@pb.route('/yuqingChar') | ||
| 117 | +def yuqingChar(): | ||
| 118 | + username = session.get('username') | ||
| 119 | + xData,yData,bieData = getYuQingCharDataOne() | ||
| 120 | + bieData1,bieData2 = getYuQingCharDataTwo() | ||
| 121 | + x1Data,y1Data = getYuQingCharDataThree() | ||
| 122 | + return render_template('yuqingChar.html', | ||
| 123 | + username=username, | ||
| 124 | + xData=xData, | ||
| 125 | + yData=yData, | ||
| 126 | + bieData=bieData, | ||
| 127 | + bieData1=bieData1, | ||
| 128 | + bieData2=bieData2, | ||
| 129 | + x1Data=x1Data, | ||
| 130 | + y1Data=y1Data | ||
| 131 | + ) | ||
| 132 | + | ||
| 133 | +@pb.route('/articleCloud') | ||
| 134 | +def articleCloud(): | ||
| 135 | + username = session.get('username') | ||
| 136 | + return render_template('articleContentCloud.html', | ||
| 137 | + username=username | ||
| 138 | + ) |
views/page/templates/hotWord.html
0 → 100644
| 1 | +{% extends 'base_page.html' %} | ||
| 2 | +{% block title %} | ||
| 3 | + 热词统计 | ||
| 4 | +{% endblock %} | ||
| 5 | + | ||
| 6 | +{% block nav %} | ||
| 7 | +<nav class="iq-sidebar-menu"> | ||
| 8 | + <ul id="iq-sidebar-toggle" class="side-menu"> | ||
| 9 | + <li class="px-3 pt-3 pb-2 "> | ||
| 10 | + <span class="text-uppercase small font-weight-bold">首页</span> | ||
| 11 | + </li> | ||
| 12 | + <li class=" sidebar-layout"> | ||
| 13 | + <a href="/page/home" class="svg-icon"> | ||
| 14 | + <i class=""> | ||
| 15 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 16 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path> | ||
| 17 | + </svg> | ||
| 18 | + </i> | ||
| 19 | + <span class="ml-2">首页</span> | ||
| 20 | + </a> | ||
| 21 | + </li> | ||
| 22 | + <li class="active sidebar-layout"> | ||
| 23 | + <a href="/page/hotWord" class="svg-icon "> | ||
| 24 | + <i class=""> | ||
| 25 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 26 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path> | ||
| 27 | + </svg> | ||
| 28 | + </i> | ||
| 29 | + <span class="ml-2">热词统计</span> | ||
| 30 | + </a> | ||
| 31 | + </li> | ||
| 32 | + <li class=" sidebar-layout"> | ||
| 33 | + <a href="/page/tableData" class="svg-icon"> | ||
| 34 | + <i class=""> | ||
| 35 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 36 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"></path> | ||
| 37 | + </svg> | ||
| 38 | + </i> | ||
| 39 | + <span class="ml-2">微博舆情统计</span> | ||
| 40 | + </a> | ||
| 41 | + </li> | ||
| 42 | + <li class="px-3 pt-3 pb-2 "> | ||
| 43 | + <span class="text-uppercase small font-weight-bold">数据可视化</span> | ||
| 44 | + </li> | ||
| 45 | + <li class=" sidebar-layout"> | ||
| 46 | + <a href="/page/articleChar" class="svg-icon"> | ||
| 47 | + <i class=""> | ||
| 48 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 49 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path> | ||
| 50 | + </svg> | ||
| 51 | + </i> | ||
| 52 | + <span class="ml-2">文章分析</span> | ||
| 53 | + </a> | ||
| 54 | + </li> | ||
| 55 | + <li class=" sidebar-layout"> | ||
| 56 | + <a href="/page/ipChar" class="svg-icon"> | ||
| 57 | + <i class=""> | ||
| 58 | + <svg class="icon line" width="18" id="receipt" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 59 | + <path d="M17,16V3L13,5,10,3,7,5,3,3V17.83A3.13,3.13,0,0,0,5.84,21,3,3,0,0,0,9,18V17a1,1,0,0,1,1-1H20a1,1,0,0,1,1,1v1a3,3,0,0,1-3,3H6" style="fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></path> | ||
| 60 | + <line x1="8" y1="10" x2="12" y2="10" style="fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></line> | ||
| 61 | + </svg> | ||
| 62 | + </i> | ||
| 63 | + <span class="ml-2">IP分析</span> | ||
| 64 | + </a> | ||
| 65 | + </li> | ||
| 66 | + <li class=" sidebar-layout"> | ||
| 67 | + <a href="/page/commentChar" class="svg-icon"> | ||
| 68 | + <i class=""> | ||
| 69 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 70 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path> | ||
| 71 | + </svg> | ||
| 72 | + </i><span class="ml-2">评论分析</span> | ||
| 73 | + </a> | ||
| 74 | + </li> | ||
| 75 | + <li class=" sidebar-layout"> | ||
| 76 | + <a href="/page/yuqingChar" class="svg-icon"> | ||
| 77 | + <i class=""> | ||
| 78 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 79 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path> | ||
| 80 | + </svg> | ||
| 81 | + </i> | ||
| 82 | + <span class="ml-2">舆情分析</span> | ||
| 83 | + </a> | ||
| 84 | + </li> | ||
| 85 | + <li class="px-3 pt-3 pb-2"> | ||
| 86 | + <span class="text-uppercase small font-weight-bold">词云图</span> | ||
| 87 | + </li> | ||
| 88 | + <li class=" sidebar-layout"> | ||
| 89 | + <a href="/page/articleCloud" class="svg-icon"> | ||
| 90 | + <i class=""> | ||
| 91 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 92 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path> | ||
| 93 | + </svg> | ||
| 94 | + </i><span class="ml-2">文章内容词云图</span> | ||
| 95 | + </a> | ||
| 96 | + </li> | ||
| 97 | + </ul> | ||
| 98 | + </nav> | ||
| 99 | +{% endblock %} | ||
| 100 | +{% block content %} | ||
| 101 | + <div class="container-fluid"> | ||
| 102 | + <div class="row"> | ||
| 103 | + <div class="col-md-12 mb-4 mt-1"> | ||
| 104 | + <div class="d-flex flex-wrap justify-content-between align-items-center"> | ||
| 105 | + <h4 class="font-weight-bold">热词统计页</h4> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + </div> | ||
| 109 | + <div class="row"> | ||
| 110 | + <div class="col-lg-12"> | ||
| 111 | + <div class="card card-block card-stretch card-height"> | ||
| 112 | + <div class="card-body"> | ||
| 113 | + <div class="collapse" id="form-element-15"> | ||
| 114 | + <div class="card"><kbd class="bg-dark"><pre id="select-size" class="text-white"><code> | ||
| 115 | +<div class="form-group"> | ||
| 116 | + <label>Small</label> | ||
| 117 | + <select class="form-control form-control-sm mb-3"> | ||
| 118 | + <option selected="">Open this select menu</option> | ||
| 119 | + <option value="1">One</option> | ||
| 120 | + <option value="2">Two</option> | ||
| 121 | + <option value="3">Three</option> | ||
| 122 | + </select> | ||
| 123 | +</div> | ||
| 124 | +<div class="form-group"> | ||
| 125 | + <label>Default</label> | ||
| 126 | + <select class="form-control mb-3"> | ||
| 127 | + <option selected="">Open this select menu</option> | ||
| 128 | + <option value="1">One</option> | ||
| 129 | + <option value="2">Two</option> | ||
| 130 | + <option value="3">Three</option> | ||
| 131 | + </select> | ||
| 132 | +</div> | ||
| 133 | +<div class="form-group"> | ||
| 134 | + <label>Large</label> | ||
| 135 | + <select class="form-control form-control-lg"> | ||
| 136 | + <option selected="">Open this select menu</option> | ||
| 137 | + <option value="1">One</option> | ||
| 138 | + <option value="2">Two</option> | ||
| 139 | + <option value="3">Three</option> | ||
| 140 | + </select> | ||
| 141 | +</div> | ||
| 142 | +</code></pre></kbd></div> | ||
| 143 | + </div> | ||
| 144 | + <div class="form-group"> | ||
| 145 | + <label>热词选择</label> | ||
| 146 | + <select onchange="hotWordChange(event)" class="form-control mb-3"> | ||
| 147 | + {% for i in hotWordList %} | ||
| 148 | + {% if defaultHotWord == i[0] %} | ||
| 149 | + <option selected value="{{ i[0] }}">{{ i[0] }}</option> | ||
| 150 | + {% else %} | ||
| 151 | + <option value="{{ i[0] }}">{{ i[0] }}</option> | ||
| 152 | + {% endif %} | ||
| 153 | + {% endfor %} | ||
| 154 | + </select> | ||
| 155 | + <script> | ||
| 156 | + function hotWordChange(e){ | ||
| 157 | + window.location.href = 'http://127.0.0.1:5000/page/hotWord?hotWord=' + e.target.value | ||
| 158 | + } | ||
| 159 | + </script> | ||
| 160 | + </div> | ||
| 161 | + </div> | ||
| 162 | + </div> | ||
| 163 | + | ||
| 164 | + </div> | ||
| 165 | + </div> | ||
| 166 | + <div class="row" style="justify-content: center"> | ||
| 167 | + <div class="col-md-6 col-xl-6"> | ||
| 168 | + <div class="card"> | ||
| 169 | + <div class="card-body"> | ||
| 170 | + <h4 class="card-title font-size-16 mt-0">{{ defaultHotWord }}</h4> | ||
| 171 | + </div> | ||
| 172 | + <ul class="list-group list-group-flush"> | ||
| 173 | + <li class="list-group-item">热词名称:{{ defaultHotWord }}</li> | ||
| 174 | + <li class="list-group-item">出现次数:{{ hotWordLen }}次</li> | ||
| 175 | + <li class="list-group-item">热词情感:{{ sentences }}</li> | ||
| 176 | + </ul> | ||
| 177 | + </div> | ||
| 178 | + | ||
| 179 | + </div> | ||
| 180 | + </div> | ||
| 181 | + <div class="row"> | ||
| 182 | + <div class="col-lg-12"> | ||
| 183 | + <div class="card"> | ||
| 184 | + <div class="card-body"> | ||
| 185 | + <h4 class="card-title font-size-16 mt-0">热词年份变化趋势</h4> | ||
| 186 | + </div> | ||
| 187 | + <div id="main" style="width:100%;height: 450px"></div> | ||
| 188 | + </div> | ||
| 189 | + </div> | ||
| 190 | + </div> | ||
| 191 | + <div class="row"> | ||
| 192 | + <div class="col-lg-12"> | ||
| 193 | + <div class="card"> | ||
| 194 | + <div class="card-header d-flex justify-content-between"> | ||
| 195 | + <div class="header-title"> | ||
| 196 | + <h4 class="card-title">热词查询表格</h4> | ||
| 197 | + </div> | ||
| 198 | + <div class="header-action"> | ||
| 199 | + <i data-toggle="collapse" data-target="#datatable-1" aria-expanded="false"> | ||
| 200 | + <svg width="20" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
| 201 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"></path> | ||
| 202 | + </svg> | ||
| 203 | + </i> | ||
| 204 | + </div> | ||
| 205 | + </div> | ||
| 206 | + <div class="card-body"> | ||
| 207 | + <div class="collapse" id="datatable-1"> | ||
| 208 | + <div class="card"><kbd class="bg-dark"> | ||
| 209 | + <pre id="bootstrap-datatables" class="text-white"><code> | ||
| 210 | +<table id="datatable" class="table data-table table-striped table-bordered" > | ||
| 211 | + <thead> | ||
| 212 | + <tr> | ||
| 213 | + <th>Name</th> | ||
| 214 | + <th>Position</th> | ||
| 215 | + <th>Office</th> | ||
| 216 | + <th>Age</th> | ||
| 217 | + <th>Start date</th> | ||
| 218 | + <th>Salary</th> | ||
| 219 | + </tr> | ||
| 220 | + </thead> | ||
| 221 | + <tbody> | ||
| 222 | + <tr> | ||
| 223 | + <td>Tiger Nixon</td> | ||
| 224 | + <td>System Architect</td> | ||
| 225 | + <td>Edinburgh</td> | ||
| 226 | + <td>61</td> | ||
| 227 | + <td>2011/04/25</td> | ||
| 228 | + <td>$320,800</td> | ||
| 229 | + </tr> | ||
| 230 | + <tr> | ||
| 231 | + <td>Garrett Winters</td> | ||
| 232 | + <td>Accountant</td> | ||
| 233 | + <td>Tokyo</td> | ||
| 234 | + <td>63</td> | ||
| 235 | + <td>2011/07/25</td> | ||
| 236 | + <td>$170,750</td> | ||
| 237 | + </tr> | ||
| 238 | + <tr> | ||
| 239 | + <td>Ashton Cox</td> | ||
| 240 | + <td>Junior Technical Author</td> | ||
| 241 | + <td>San Francisco</td> | ||
| 242 | + <td>66</td> | ||
| 243 | + <td>2009/01/12</td> | ||
| 244 | + <td>$86,000</td> | ||
| 245 | + </tr> | ||
| 246 | + <tr> | ||
| 247 | + <td>Cedric Kelly</td> | ||
| 248 | + <td>Senior Javascript Developer</td> | ||
| 249 | + <td>Edinburgh</td> | ||
| 250 | + <td>22</td> | ||
| 251 | + <td>2012/03/29</td> | ||
| 252 | + <td>$433,060</td> | ||
| 253 | + </tr> | ||
| 254 | + <tr> | ||
| 255 | + <td>Airi Satou</td> | ||
| 256 | + <td>Accountant</td> | ||
| 257 | + <td>Tokyo</td> | ||
| 258 | + <td>33</td> | ||
| 259 | + <td>2008/11/28</td> | ||
| 260 | + <td>$162,700</td> | ||
| 261 | + </tr> | ||
| 262 | + <tr> | ||
| 263 | + <td>Brielle Williamson</td> | ||
| 264 | + <td>Integration Specialist</td> | ||
| 265 | + <td>New York</td> | ||
| 266 | + <td>61</td> | ||
| 267 | + <td>2012/12/02</td> | ||
| 268 | + <td>$372,000</td> | ||
| 269 | + </tr> | ||
| 270 | + <tr> | ||
| 271 | + <td>Herrod Chandler</td> | ||
| 272 | + <td>Sales Assistant</td> | ||
| 273 | + <td>San Francisco</td> | ||
| 274 | + <td>59</td> | ||
| 275 | + <td>2012/08/06</td> | ||
| 276 | + <td>$137,500</td> | ||
| 277 | + </tr> | ||
| 278 | + <tr> | ||
| 279 | + <td>Rhona Davidson</td> | ||
| 280 | + <td>Integration Specialist</td> | ||
| 281 | + <td>Tokyo</td> | ||
| 282 | + <td>55</td> | ||
| 283 | + <td>2010/10/14</td> | ||
| 284 | + <td>$327,900</td> | ||
| 285 | + </tr> | ||
| 286 | + <tr> | ||
| 287 | + <td>Colleen Hurst</td> | ||
| 288 | + <td>Javascript Developer</td> | ||
| 289 | + <td>San Francisco</td> | ||
| 290 | + <td>39</td> | ||
| 291 | + <td>2009/09/15</td> | ||
| 292 | + <td>$205,500</td> | ||
| 293 | + </tr> | ||
| 294 | + <tr> | ||
| 295 | + <td>Sonya Frost</td> | ||
| 296 | + <td>Software Engineer</td> | ||
| 297 | + <td>Edinburgh</td> | ||
| 298 | + <td>23</td> | ||
| 299 | + <td>2008/12/13</td> | ||
| 300 | + <td>$103,600</td> | ||
| 301 | + </tr> | ||
| 302 | + <tr> | ||
| 303 | + <td>Jena Gaines</td> | ||
| 304 | + <td>Office Manager</td> | ||
| 305 | + <td>London</td> | ||
| 306 | + <td>30</td> | ||
| 307 | + <td>2008/12/19</td> | ||
| 308 | + <td>$90,560</td> | ||
| 309 | + </tr> | ||
| 310 | + <tr> | ||
| 311 | + <td>Quinn Flynn</td> | ||
| 312 | + <td>Support Lead</td> | ||
| 313 | + <td>Edinburgh</td> | ||
| 314 | + <td>22</td> | ||
| 315 | + <td>2013/03/03</td> | ||
| 316 | + <td>$342,000</td> | ||
| 317 | + </tr> | ||
| 318 | + <tr> | ||
| 319 | + <td>Charde Marshall</td> | ||
| 320 | + <td>Regional Director</td> | ||
| 321 | + <td>San Francisco</td> | ||
| 322 | + <td>36</td> | ||
| 323 | + <td>2008/10/16</td> | ||
| 324 | + <td>$470,600</td> | ||
| 325 | + </tr> | ||
| 326 | + <tr> | ||
| 327 | + <td>Haley Kennedy</td> | ||
| 328 | + <td>Senior Marketing Designer</td> | ||
| 329 | + <td>London</td> | ||
| 330 | + <td>43</td> | ||
| 331 | + <td>2012/12/18</td> | ||
| 332 | + <td>$313,500</td> | ||
| 333 | + </tr> | ||
| 334 | + <tr> | ||
| 335 | + <td>Tatyana Fitzpatrick</td> | ||
| 336 | + <td>Regional Director</td> | ||
| 337 | + <td>London</td> | ||
| 338 | + <td>19</td> | ||
| 339 | + <td>2010/03/17</td> | ||
| 340 | + <td>$385,750</td> | ||
| 341 | + </tr> | ||
| 342 | + <tr> | ||
| 343 | + <td>Michael Silva</td> | ||
| 344 | + <td>Marketing Designer</td> | ||
| 345 | + <td>London</td> | ||
| 346 | + <td>66</td> | ||
| 347 | + <td>2012/11/27</td> | ||
| 348 | + <td>$198,500</td> | ||
| 349 | + </tr> | ||
| 350 | + <tr> | ||
| 351 | + <td>Paul Byrd</td> | ||
| 352 | + <td>Chief Financial Officer (CFO)</td> | ||
| 353 | + <td>New York</td> | ||
| 354 | + <td>64</td> | ||
| 355 | + <td>2010/06/09</td> | ||
| 356 | + <td>$725,000</td> | ||
| 357 | + </tr> | ||
| 358 | + <tr> | ||
| 359 | + <td>Gloria Little</td> | ||
| 360 | + <td>Systems Administrator</td> | ||
| 361 | + <td>New York</td> | ||
| 362 | + <td>59</td> | ||
| 363 | + <td>2009/04/10</td> | ||
| 364 | + <td>$237,500</td> | ||
| 365 | + </tr> | ||
| 366 | + <tr> | ||
| 367 | + <td>Bradley Greer</td> | ||
| 368 | + <td>Software Engineer</td> | ||
| 369 | + <td>London</td> | ||
| 370 | + <td>41</td> | ||
| 371 | + <td>2012/10/13</td> | ||
| 372 | + <td>$132,000</td> | ||
| 373 | + </tr> | ||
| 374 | + <tr> | ||
| 375 | + <td>Dai Rios</td> | ||
| 376 | + <td>Personnel Lead</td> | ||
| 377 | + <td>Edinburgh</td> | ||
| 378 | + <td>35</td> | ||
| 379 | + <td>2012/09/26</td> | ||
| 380 | + <td>$217,500</td> | ||
| 381 | + </tr> | ||
| 382 | +</table> | ||
| 383 | +</code></pre></kbd></div> | ||
| 384 | + </div> | ||
| 385 | + <p>根据选择的热词从而查询出评论数据</p> | ||
| 386 | + <div class="table-responsive"> | ||
| 387 | + <div id="datatable-1_wrapper" class="dataTables_wrapper dt-bootstrap4"> | ||
| 388 | + <div class="row"><div class="col-sm-12"><table id="datatable-1" class="table data-table table-striped table-bordered dataTable" role="grid" aria-describedby="datatable-1_info"> | ||
| 389 | + <thead> | ||
| 390 | + <tr role="row"> | ||
| 391 | + <th class="sorting sorting_asc" tabindex="0" aria-controls="datatable-1" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Name: activate to sort column descending" style="width: 250.844px;">文章ID</th> | ||
| 392 | + <th class="sorting" tabindex="0" aria-controls="datatable-1" rowspan="1" colspan="1" aria-label="Position: activate to sort column ascending" style="width: 392.094px;">评论用户</th> | ||
| 393 | + <th class="sorting" tabindex="0" aria-controls="datatable-1" rowspan="1" colspan="1" aria-label="Office: activate to sort column ascending" style="width: 190.75px;">评论性别</th> | ||
| 394 | + <th class="sorting" tabindex="0" aria-controls="datatable-1" rowspan="1" colspan="1" aria-label="Age: activate to sort column ascending" style="width: 84.2656px;">评论地址</th> | ||
| 395 | + <th class="sorting" tabindex="0" aria-controls="datatable-1" rowspan="1" colspan="1" aria-label="Start date: activate to sort column ascending" style="width: 172.594px;">评论内容</th> | ||
| 396 | + <th class="text-right sorting" tabindex="0" aria-controls="datatable-1" rowspan="1" colspan="1" aria-label="Salary: activate to sort column ascending" style="width: 158.453px;">点赞量</th></tr> | ||
| 397 | + </thead> | ||
| 398 | + <tbody> | ||
| 399 | + {% for i in comments %} | ||
| 400 | + <tr class="odd"> | ||
| 401 | + <td class="sorting_1">{{ i[0] }}</td> | ||
| 402 | + <td>{{ i[5] }}</td> | ||
| 403 | + <td> | ||
| 404 | + {% if i[6] =='f' %} | ||
| 405 | + 女生 | ||
| 406 | + {% else %} | ||
| 407 | + 男生 | ||
| 408 | + {% endif %} | ||
| 409 | + </td> | ||
| 410 | + <td>{{ i[3] }}</td> | ||
| 411 | + <td>{{ i[4] }}</td> | ||
| 412 | + <td class="text-right">👍{{ i[2] }}</td> | ||
| 413 | + </tr> | ||
| 414 | + {% endfor %} | ||
| 415 | + </tbody> | ||
| 416 | + </table></div></div> | ||
| 417 | + </div> | ||
| 418 | + </div> | ||
| 419 | + </div> | ||
| 420 | + </div> | ||
| 421 | + </div> | ||
| 422 | +</div> | ||
| 423 | + | ||
| 424 | +{% endblock %} | ||
| 425 | + | ||
| 426 | +{% block echarts %} | ||
| 427 | + <script> | ||
| 428 | + var chartDom = document.getElementById('main'); | ||
| 429 | + var myChart = echarts.init(chartDom); | ||
| 430 | + var option; | ||
| 431 | + | ||
| 432 | + option = { | ||
| 433 | + tooltip: { | ||
| 434 | + trigger: 'axis' | ||
| 435 | + }, | ||
| 436 | + legend: { | ||
| 437 | + data: ['热词出现时间分布个数'] | ||
| 438 | + }, | ||
| 439 | + toolbox: { | ||
| 440 | + show: true, | ||
| 441 | + feature: { | ||
| 442 | + dataView: { show: true, readOnly: false }, | ||
| 443 | + magicType: { show: true, type: ['line', 'bar'] }, | ||
| 444 | + restore: { show: true }, | ||
| 445 | + saveAsImage: { show: true } | ||
| 446 | + } | ||
| 447 | + }, | ||
| 448 | + calculable: true, | ||
| 449 | + xAxis: [ | ||
| 450 | + { | ||
| 451 | + type: 'category', | ||
| 452 | + // prettier-ignore | ||
| 453 | + data: {{ xData | tojson }} | ||
| 454 | + } | ||
| 455 | + ], | ||
| 456 | + yAxis: [ | ||
| 457 | + { | ||
| 458 | + type: 'value' | ||
| 459 | + } | ||
| 460 | + ], | ||
| 461 | + dataZoom: [ | ||
| 462 | + { | ||
| 463 | + show: true, | ||
| 464 | + start: 10, | ||
| 465 | + end: 60 | ||
| 466 | + }, | ||
| 467 | + { | ||
| 468 | + type: 'inside', | ||
| 469 | + start: 10, | ||
| 470 | + end: 60 | ||
| 471 | + } | ||
| 472 | + ], | ||
| 473 | + series: [ | ||
| 474 | + { | ||
| 475 | + name: '热词出现时间分布个数', | ||
| 476 | + type: 'bar', | ||
| 477 | + data: {{ yData }}, | ||
| 478 | + markPoint: { | ||
| 479 | + data: [ | ||
| 480 | + { type: 'max', name: 'Max' }, | ||
| 481 | + { type: 'min', name: 'Min' } | ||
| 482 | + ] | ||
| 483 | + }, | ||
| 484 | + markLine: { | ||
| 485 | + data: [{ type: 'average', name: 'Avg' }] | ||
| 486 | + } | ||
| 487 | + } | ||
| 488 | + ] | ||
| 489 | + }; | ||
| 490 | + | ||
| 491 | + option && myChart.setOption(option); | ||
| 492 | + | ||
| 493 | + </script> | ||
| 494 | +{% endblock %} |
views/page/templates/index.html
0 → 100644
| 1 | +{% extends 'base_page.html' %} |
views/page/templates/tableData.html
0 → 100644
| 1 | +{% extends 'base_page.html' %} | ||
| 2 | + | ||
| 3 | +{% block title %} | ||
| 4 | +微博舆情统计页 | ||
| 5 | +{% endblock %} | ||
| 6 | +{% block nav %} | ||
| 7 | +<nav class="iq-sidebar-menu"> | ||
| 8 | + <ul id="iq-sidebar-toggle" class="side-menu"> | ||
| 9 | + <li class="px-3 pt-3 pb-2 "> | ||
| 10 | + <span class="text-uppercase small font-weight-bold">首页</span> | ||
| 11 | + </li> | ||
| 12 | + <li class=" sidebar-layout"> | ||
| 13 | + <a href="/page/home" class="svg-icon"> | ||
| 14 | + <i class=""> | ||
| 15 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 16 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path> | ||
| 17 | + </svg> | ||
| 18 | + </i> | ||
| 19 | + <span class="ml-2">首页</span> | ||
| 20 | + </a> | ||
| 21 | + </li> | ||
| 22 | + <li class=" sidebar-layout"> | ||
| 23 | + <a href="/page/hotWord" class="svg-icon "> | ||
| 24 | + <i class=""> | ||
| 25 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 26 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path> | ||
| 27 | + </svg> | ||
| 28 | + </i> | ||
| 29 | + <span class="ml-2">热词统计</span> | ||
| 30 | + </a> | ||
| 31 | + </li> | ||
| 32 | + <li class="active sidebar-layout"> | ||
| 33 | + <a href="/page/tableData" class="svg-icon"> | ||
| 34 | + <i class=""> | ||
| 35 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 36 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"></path> | ||
| 37 | + </svg> | ||
| 38 | + </i> | ||
| 39 | + <span class="ml-2">微博舆情统计</span> | ||
| 40 | + </a> | ||
| 41 | + </li> | ||
| 42 | + <li class="px-3 pt-3 pb-2 "> | ||
| 43 | + <span class="text-uppercase small font-weight-bold">数据可视化</span> | ||
| 44 | + </li> | ||
| 45 | + <li class=" sidebar-layout"> | ||
| 46 | + <a href="/page/articleChar" class="svg-icon"> | ||
| 47 | + <i class=""> | ||
| 48 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 49 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path> | ||
| 50 | + </svg> | ||
| 51 | + </i> | ||
| 52 | + <span class="ml-2">文章分析</span> | ||
| 53 | + </a> | ||
| 54 | + </li> | ||
| 55 | + <li class=" sidebar-layout"> | ||
| 56 | + <a href="/page/ipChar" class="svg-icon"> | ||
| 57 | + <i class=""> | ||
| 58 | + <svg class="icon line" width="18" id="receipt" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 59 | + <path d="M17,16V3L13,5,10,3,7,5,3,3V17.83A3.13,3.13,0,0,0,5.84,21,3,3,0,0,0,9,18V17a1,1,0,0,1,1-1H20a1,1,0,0,1,1,1v1a3,3,0,0,1-3,3H6" style="fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></path> | ||
| 60 | + <line x1="8" y1="10" x2="12" y2="10" style="fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></line> | ||
| 61 | + </svg> | ||
| 62 | + </i> | ||
| 63 | + <span class="ml-2">IP分析</span> | ||
| 64 | + </a> | ||
| 65 | + </li> | ||
| 66 | + <li class=" sidebar-layout"> | ||
| 67 | + <a href="/page/commentChar" class="svg-icon"> | ||
| 68 | + <i class=""> | ||
| 69 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 70 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path> | ||
| 71 | + </svg> | ||
| 72 | + </i><span class="ml-2">评论分析</span> | ||
| 73 | + </a> | ||
| 74 | + </li> | ||
| 75 | + <li class=" sidebar-layout"> | ||
| 76 | + <a href="/page/yuqingChar" class="svg-icon"> | ||
| 77 | + <i class=""> | ||
| 78 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 79 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path> | ||
| 80 | + </svg> | ||
| 81 | + </i> | ||
| 82 | + <span class="ml-2">舆情分析</span> | ||
| 83 | + </a> | ||
| 84 | + </li> | ||
| 85 | + <li class="px-3 pt-3 pb-2"> | ||
| 86 | + <span class="text-uppercase small font-weight-bold">词云图</span> | ||
| 87 | + </li> | ||
| 88 | + <li class=" sidebar-layout"> | ||
| 89 | + <a href="/page/articleCloud" class="svg-icon"> | ||
| 90 | + <i class=""> | ||
| 91 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 92 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path> | ||
| 93 | + </svg> | ||
| 94 | + </i><span class="ml-2">文章内容词云图</span> | ||
| 95 | + </a> | ||
| 96 | + </li> | ||
| 97 | + </ul> | ||
| 98 | + </nav> | ||
| 99 | +{% endblock %} | ||
| 100 | +{% block content %} | ||
| 101 | + <div class="container-fluid"> | ||
| 102 | + <div class="row"> | ||
| 103 | + <div class="col-md-12 mb-4 mt-1"> | ||
| 104 | + <div class="d-flex flex-wrap justify-content-between align-items-center"> | ||
| 105 | + <h4 class="font-weight-bold">微博舆情统计页</h4> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + </div> | ||
| 109 | + | ||
| 110 | + <div class="row"> | ||
| 111 | + <div class="col-sm-12"> | ||
| 112 | + <div class="card"> | ||
| 113 | + <div class="card-header d-flex justify-content-between"> | ||
| 114 | + <div class="header-title"> | ||
| 115 | + <h4 class="card-title">微博文章统计表格 - 舆情 情感分类 | ||
| 116 | +</h4> | ||
| 117 | + </div> | ||
| 118 | + <div class="header-action"> | ||
| 119 | + <i data-toggle="collapse" data-target="#datatable-1" aria-expanded="false"> | ||
| 120 | + <svg width="20" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
| 121 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"></path> | ||
| 122 | + </svg> | ||
| 123 | + </i> | ||
| 124 | + </div> | ||
| 125 | + </div> | ||
| 126 | + <div class="card-body"> | ||
| 127 | + <p><a href="/page/tableData?flag=True" class="btn btn-primary btn-sm">情感分类</a></p> | ||
| 128 | + <div class="table-responsive"> | ||
| 129 | + <div id="datatable-1_wrapper" class="dataTables_wrapper dt-bootstrap4"> | ||
| 130 | + <div class="row"> | ||
| 131 | + <table id="datatable-1" class="table data-table table-striped table-bordered dataTable" role="grid" aria-describedby="datatable-1_info"> | ||
| 132 | + <thead> | ||
| 133 | + <tr> | ||
| 134 | + <th style="font-weight: bold"> | ||
| 135 | + 文章ID | ||
| 136 | + </th> | ||
| 137 | + <th style="font-weight: bold"> | ||
| 138 | + 文章IP | ||
| 139 | + </th> | ||
| 140 | + <th style="font-weight: bold"> | ||
| 141 | + 点赞量 | ||
| 142 | + </th> | ||
| 143 | + <th style="font-weight: bold"> | ||
| 144 | + 转发量 | ||
| 145 | + </th> | ||
| 146 | + <th style="font-weight: bold"> | ||
| 147 | + 评论量 | ||
| 148 | + </th> | ||
| 149 | + <th style="font-weight: bold"> | ||
| 150 | + 类型 | ||
| 151 | + </th> | ||
| 152 | + <th style="font-weight: bold"> | ||
| 153 | + 内容 | ||
| 154 | + </th> | ||
| 155 | + <th style="font-weight: bold"> | ||
| 156 | + 发布时间 | ||
| 157 | + </th> | ||
| 158 | + {% if defaultFlag %} | ||
| 159 | + <th style="font-weight: bold"> | ||
| 160 | + 情感分类 | ||
| 161 | + </th> | ||
| 162 | + {% endif %} | ||
| 163 | + </tr> | ||
| 164 | + </thead> | ||
| 165 | + <tbody> | ||
| 166 | + {% for article in tableData %} | ||
| 167 | + <tr class="even"> | ||
| 168 | + <td style="width:330px" class="sorting_1"> | ||
| 169 | + <a href="{{ article[9] }}"> | ||
| 170 | + {{ article[0] }} | ||
| 171 | + </a> | ||
| 172 | + </td> | ||
| 173 | + <td style="width:90px">{{ article[4] }}</td> | ||
| 174 | + <td style="width:90px">👍{{ article[1] }}</td> | ||
| 175 | + <td style="width:90px">🥇{{ article[2] }}</td> | ||
| 176 | + <td style="width:90px">🔥{{ article[3] }}</td> | ||
| 177 | + <td style="width:90px" class="text-right">{{ article[8] }}</td> | ||
| 178 | + <td style="width:155px" class="text-right">{{ article[5] }}</td> | ||
| 179 | + <td style="width:90px" class="text-right">{{ article[7] }}</td> | ||
| 180 | + {% if defaultFlag %} | ||
| 181 | + <td style="width:90px"> | ||
| 182 | + {% if article[-1] == '正面' %} | ||
| 183 | + <span class="text-success"> | ||
| 184 | + {{ article[-1] }} | ||
| 185 | + </span> | ||
| 186 | + | ||
| 187 | + {% else %} | ||
| 188 | + <span class="text-danger"> | ||
| 189 | + {{ article[-1] }} | ||
| 190 | + </span> | ||
| 191 | + | ||
| 192 | + {% endif %} | ||
| 193 | + </td> | ||
| 194 | + {% endif %} | ||
| 195 | + </tr> | ||
| 196 | + {% endfor %} | ||
| 197 | + </tbody> | ||
| 198 | + </table> | ||
| 199 | + </div> | ||
| 200 | + </div> | ||
| 201 | + </div> | ||
| 202 | + </div> | ||
| 203 | + </div> | ||
| 204 | + </div> | ||
| 205 | + </div> | ||
| 206 | + | ||
| 207 | + </div> | ||
| 208 | +{% endblock %} | ||
| 209 | + | ||
| 210 | + | ||
| 211 | +{% block echarts %} | ||
| 212 | + <script> | ||
| 213 | + | ||
| 214 | + </script> | ||
| 215 | +{% endblock %} |
views/page/templates/yuqingChar.html
0 → 100644
| 1 | +{% extends 'base_page.html' %} | ||
| 2 | +{% block title %} | ||
| 3 | + 舆情分析 | ||
| 4 | +{% endblock %} | ||
| 5 | +{% block nav %} | ||
| 6 | +<nav class="iq-sidebar-menu"> | ||
| 7 | + <ul id="iq-sidebar-toggle" class="side-menu"> | ||
| 8 | + <li class="px-3 pt-3 pb-2 "> | ||
| 9 | + <span class="text-uppercase small font-weight-bold">首页</span> | ||
| 10 | + </li> | ||
| 11 | + <li class=" sidebar-layout"> | ||
| 12 | + <a href="/page/home" class="svg-icon"> | ||
| 13 | + <i class=""> | ||
| 14 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 15 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path> | ||
| 16 | + </svg> | ||
| 17 | + </i> | ||
| 18 | + <span class="ml-2">首页</span> | ||
| 19 | + </a> | ||
| 20 | + </li> | ||
| 21 | + <li class=" sidebar-layout"> | ||
| 22 | + <a href="/page/hotWord" class="svg-icon "> | ||
| 23 | + <i class=""> | ||
| 24 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 25 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path> | ||
| 26 | + </svg> | ||
| 27 | + </i> | ||
| 28 | + <span class="ml-2">热词统计</span> | ||
| 29 | + </a> | ||
| 30 | + </li> | ||
| 31 | + <li class=" sidebar-layout"> | ||
| 32 | + <a href="/page/tableData" class="svg-icon"> | ||
| 33 | + <i class=""> | ||
| 34 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 35 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"></path> | ||
| 36 | + </svg> | ||
| 37 | + </i> | ||
| 38 | + <span class="ml-2">微博舆情统计</span> | ||
| 39 | + </a> | ||
| 40 | + </li> | ||
| 41 | + <li class="px-3 pt-3 pb-2 "> | ||
| 42 | + <span class="text-uppercase small font-weight-bold">数据可视化</span> | ||
| 43 | + </li> | ||
| 44 | + <li class=" sidebar-layout"> | ||
| 45 | + <a href="/page/articleChar" class="svg-icon"> | ||
| 46 | + <i class=""> | ||
| 47 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 48 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"></path> | ||
| 49 | + </svg> | ||
| 50 | + </i> | ||
| 51 | + <span class="ml-2">文章分析</span> | ||
| 52 | + </a> | ||
| 53 | + </li> | ||
| 54 | + <li class=" sidebar-layout"> | ||
| 55 | + <a href="/page/ipChar" class="svg-icon"> | ||
| 56 | + <i class=""> | ||
| 57 | + <svg class="icon line" width="18" id="receipt" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 58 | + <path d="M17,16V3L13,5,10,3,7,5,3,3V17.83A3.13,3.13,0,0,0,5.84,21,3,3,0,0,0,9,18V17a1,1,0,0,1,1-1H20a1,1,0,0,1,1,1v1a3,3,0,0,1-3,3H6" style="fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></path> | ||
| 59 | + <line x1="8" y1="10" x2="12" y2="10" style="fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></line> | ||
| 60 | + </svg> | ||
| 61 | + </i> | ||
| 62 | + <span class="ml-2">IP分析</span> | ||
| 63 | + </a> | ||
| 64 | + </li> | ||
| 65 | + <li class=" sidebar-layout"> | ||
| 66 | + <a href="/page/commentChar" class="svg-icon"> | ||
| 67 | + <i class=""> | ||
| 68 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 69 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"></path> | ||
| 70 | + </svg> | ||
| 71 | + </i><span class="ml-2">评论分析</span> | ||
| 72 | + </a> | ||
| 73 | + </li> | ||
| 74 | + <li class="active sidebar-layout"> | ||
| 75 | + <a href="/page/yuqingChar" class="svg-icon"> | ||
| 76 | + <i class=""> | ||
| 77 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 78 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path> | ||
| 79 | + </svg> | ||
| 80 | + </i> | ||
| 81 | + <span class="ml-2">舆情分析</span> | ||
| 82 | + </a> | ||
| 83 | + </li> | ||
| 84 | + <li class="px-3 pt-3 pb-2"> | ||
| 85 | + <span class="text-uppercase small font-weight-bold">词云图</span> | ||
| 86 | + </li> | ||
| 87 | + <li class=" sidebar-layout"> | ||
| 88 | + <a href="/page/articleCloud" class="svg-icon"> | ||
| 89 | + <i class=""> | ||
| 90 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 91 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path> | ||
| 92 | + </svg> | ||
| 93 | + </i><span class="ml-2">文章内容词云图</span> | ||
| 94 | + </a> | ||
| 95 | + </li> | ||
| 96 | + </ul> | ||
| 97 | + </nav> | ||
| 98 | +{% endblock %} | ||
| 99 | + | ||
| 100 | +{% block content %} | ||
| 101 | + <div class="container-fluid"> | ||
| 102 | + <div class="row"> | ||
| 103 | + <div class="col-md-12 mb-4 mt-1"> | ||
| 104 | + <div class="d-flex flex-wrap justify-content-between align-items-center"> | ||
| 105 | + <h4 class="font-weight-bold">舆情分析</h4> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + </div> | ||
| 109 | + <div class="row"> | ||
| 110 | + <div class="col-lg-6"> | ||
| 111 | + <div class="card card-block"> | ||
| 112 | + <div class="card-header d-flex justify-content-between pb-0"> | ||
| 113 | + <div class="header-title"> | ||
| 114 | + <h4 class="card-title mb-0">热词情感趋势柱状图</h4> | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 117 | + <div class="card-body"> | ||
| 118 | + <div id="main" style="width: 100%;height: 450px"></div> | ||
| 119 | + </div> | ||
| 120 | + </div> | ||
| 121 | + </div> | ||
| 122 | + <div class="col-lg-6"> | ||
| 123 | + <div class="card card-block"> | ||
| 124 | + <div class="card-header d-flex justify-content-between pb-0"> | ||
| 125 | + <div class="header-title"> | ||
| 126 | + <h4 class="card-title mb-0">热词情感趋势树形图</h4> | ||
| 127 | + </div> | ||
| 128 | + </div> | ||
| 129 | + <div class="card-body"> | ||
| 130 | + <div id="mainTwo" style="width: 100%;height: 450px"></div> | ||
| 131 | + </div> | ||
| 132 | + </div> | ||
| 133 | + </div> | ||
| 134 | + <div class="col-lg-6"> | ||
| 135 | + <div class="card card-block"> | ||
| 136 | + <div class="card-header d-flex justify-content-between pb-0"> | ||
| 137 | + <div class="header-title"> | ||
| 138 | + <h4 class="card-title mb-0">文章内容与评论内容舆情趋势饼状图</h4> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + <div class="card-body"> | ||
| 142 | + <div id="mainThree" style="width: 100%;height: 450px"></div> | ||
| 143 | + </div> | ||
| 144 | + </div> | ||
| 145 | + </div> | ||
| 146 | + <div class="col-lg-6"> | ||
| 147 | + <div class="card card-block"> | ||
| 148 | + <div class="card-header d-flex justify-content-between pb-0"> | ||
| 149 | + <div class="header-title"> | ||
| 150 | + <h4 class="card-title mb-0">热词TOP10</h4> | ||
| 151 | + </div> | ||
| 152 | + </div> | ||
| 153 | + <div class="card-body"> | ||
| 154 | + <div id="mainFore" style="width: 100%;height: 450px"></div> | ||
| 155 | + </div> | ||
| 156 | + </div> | ||
| 157 | + </div> | ||
| 158 | + </div> | ||
| 159 | + </div> | ||
| 160 | + | ||
| 161 | +{% endblock %} | ||
| 162 | + | ||
| 163 | +{% block echarts %} | ||
| 164 | + <script> | ||
| 165 | + var chartDom = document.getElementById('main'); | ||
| 166 | + var myChart = echarts.init(chartDom); | ||
| 167 | + var option; | ||
| 168 | + | ||
| 169 | + var colors = ['#66CC99', '#FFCC66', '#FF6666']; | ||
| 170 | + option = { | ||
| 171 | + title: { | ||
| 172 | + text: '热词情感分析柱状图' | ||
| 173 | + }, | ||
| 174 | + tooltip: { | ||
| 175 | + trigger: 'axis' | ||
| 176 | + }, | ||
| 177 | + legend: { | ||
| 178 | + data: ['Rainfall'] | ||
| 179 | + }, | ||
| 180 | + toolbox: { | ||
| 181 | + show: true, | ||
| 182 | + feature: { | ||
| 183 | + dataView: { show: true, readOnly: false }, | ||
| 184 | + magicType: { show: true, type: ['line', 'bar'] }, | ||
| 185 | + restore: { show: true }, | ||
| 186 | + saveAsImage: { show: true } | ||
| 187 | + } | ||
| 188 | + }, | ||
| 189 | + calculable: true, | ||
| 190 | + xAxis: [ | ||
| 191 | + { | ||
| 192 | + type: 'category', | ||
| 193 | + // prettier-ignore | ||
| 194 | + data: {{ xData | tojson }} | ||
| 195 | + } | ||
| 196 | + ], | ||
| 197 | + yAxis: [ | ||
| 198 | + { | ||
| 199 | + type: 'value' | ||
| 200 | + } | ||
| 201 | + ], | ||
| 202 | + series: [ | ||
| 203 | + { | ||
| 204 | + name: '舆情个数', | ||
| 205 | + type: 'bar', | ||
| 206 | + data: {{ yData }}, | ||
| 207 | + markPoint: { | ||
| 208 | + data: [ | ||
| 209 | + { type: 'max', name: 'Max' }, | ||
| 210 | + { type: 'min', name: 'Min' } | ||
| 211 | + ] | ||
| 212 | + }, | ||
| 213 | + markLine: { | ||
| 214 | + data: [{ type: 'average', name: 'Avg' }] | ||
| 215 | + }, | ||
| 216 | + itemStyle: { | ||
| 217 | + color: function (parmas) { | ||
| 218 | + return colors[parmas.dataIndex % colors.length]; | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + ] | ||
| 223 | + }; | ||
| 224 | + | ||
| 225 | + option && myChart.setOption(option); | ||
| 226 | + | ||
| 227 | + </script> | ||
| 228 | + <script> | ||
| 229 | + var chartDom = document.getElementById('mainTwo'); | ||
| 230 | + var myChart = echarts.init(chartDom); | ||
| 231 | + var option; | ||
| 232 | + | ||
| 233 | + option = { | ||
| 234 | + series: [ | ||
| 235 | + { | ||
| 236 | + type: 'treemap', | ||
| 237 | + data: {{ bieData | tojson }} | ||
| 238 | + } | ||
| 239 | + ] | ||
| 240 | + }; | ||
| 241 | + | ||
| 242 | + option && myChart.setOption(option); | ||
| 243 | + | ||
| 244 | + </script> | ||
| 245 | + <script> | ||
| 246 | + var chartDom = document.getElementById('mainThree'); | ||
| 247 | + var myChart = echarts.init(chartDom); | ||
| 248 | + var option; | ||
| 249 | + | ||
| 250 | + option = { | ||
| 251 | + tooltip: { | ||
| 252 | + trigger: 'item', | ||
| 253 | + formatter: '{a} <br/>{b}: {c} ({d}%)' | ||
| 254 | + }, | ||
| 255 | + legend: { | ||
| 256 | + data: [ | ||
| 257 | + '正面', | ||
| 258 | + '负面', | ||
| 259 | + '中性' | ||
| 260 | + ] | ||
| 261 | + }, | ||
| 262 | + series: [ | ||
| 263 | + { | ||
| 264 | + name: '评论舆情结果', | ||
| 265 | + type: 'pie', | ||
| 266 | + selectedMode: 'single', | ||
| 267 | + radius: [0, '30%'], | ||
| 268 | + label: { | ||
| 269 | + position: 'inner', | ||
| 270 | + fontSize: 14 | ||
| 271 | + }, | ||
| 272 | + labelLine: { | ||
| 273 | + show: false | ||
| 274 | + }, | ||
| 275 | + data: {{ bieData1 | tojson }} | ||
| 276 | + }, | ||
| 277 | + { | ||
| 278 | + name: '文章舆情结果', | ||
| 279 | + type: 'pie', | ||
| 280 | + radius: ['45%', '60%'], | ||
| 281 | + labelLine: { | ||
| 282 | + length: 30 | ||
| 283 | + }, | ||
| 284 | + label: { | ||
| 285 | + formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} ', | ||
| 286 | + backgroundColor: '#F6F8FC', | ||
| 287 | + borderColor: '#8C8D8E', | ||
| 288 | + borderWidth: 1, | ||
| 289 | + borderRadius: 4, | ||
| 290 | + rich: { | ||
| 291 | + a: { | ||
| 292 | + color: '#6E7079', | ||
| 293 | + lineHeight: 22, | ||
| 294 | + align: 'center' | ||
| 295 | + }, | ||
| 296 | + hr: { | ||
| 297 | + borderColor: '#8C8D8E', | ||
| 298 | + width: '100%', | ||
| 299 | + borderWidth: 1, | ||
| 300 | + height: 0 | ||
| 301 | + }, | ||
| 302 | + b: { | ||
| 303 | + color: '#4C5058', | ||
| 304 | + fontSize: 14, | ||
| 305 | + fontWeight: 'bold', | ||
| 306 | + lineHeight: 33 | ||
| 307 | + }, | ||
| 308 | + per: { | ||
| 309 | + color: '#fff', | ||
| 310 | + backgroundColor: '#4C5058', | ||
| 311 | + padding: [3, 4], | ||
| 312 | + borderRadius: 4 | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + }, | ||
| 316 | + data: {{ bieData2 | tojson }} | ||
| 317 | + } | ||
| 318 | + ] | ||
| 319 | + }; | ||
| 320 | + | ||
| 321 | + option && myChart.setOption(option); | ||
| 322 | + | ||
| 323 | + </script> | ||
| 324 | + <script> | ||
| 325 | + var chartDom = document.getElementById('mainFore'); | ||
| 326 | + var myChart = echarts.init(chartDom); | ||
| 327 | + var option; | ||
| 328 | + | ||
| 329 | + option = { | ||
| 330 | + tooltip: { | ||
| 331 | + trigger: 'axis', | ||
| 332 | + axisPointer: { | ||
| 333 | + type: 'shadow' | ||
| 334 | + } | ||
| 335 | + }, | ||
| 336 | + legend: {}, | ||
| 337 | + grid: { | ||
| 338 | + left: '3%', | ||
| 339 | + right: '4%', | ||
| 340 | + bottom: '3%', | ||
| 341 | + containLabel: true | ||
| 342 | + }, | ||
| 343 | + xAxis: { | ||
| 344 | + type: 'value', | ||
| 345 | + boundaryGap: [0, 0.01] | ||
| 346 | + }, | ||
| 347 | + yAxis: { | ||
| 348 | + type: 'category', | ||
| 349 | + data: {{ x1Data | tojson }} | ||
| 350 | + }, | ||
| 351 | + series: [ | ||
| 352 | + { | ||
| 353 | + name: '热词出现个数', | ||
| 354 | + type: 'bar', | ||
| 355 | + data:{{ y1Data }} | ||
| 356 | + } | ||
| 357 | + ] | ||
| 358 | + }; | ||
| 359 | + | ||
| 360 | + option && myChart.setOption(option); | ||
| 361 | + | ||
| 362 | + </script> | ||
| 363 | +{% endblock %} |
-
Please register or login to post a comment