Showing
13 changed files
with
666 additions
and
34 deletions
| @@ -23,9 +23,10 @@ def main(): | @@ -23,9 +23,10 @@ def main(): | ||
| 23 | 23 | ||
| 24 | # 格式整理 | 24 | # 格式整理 |
| 25 | list_count = sorted(word_count.items(),key=lambda x:x[1],reverse=True) | 25 | list_count = sorted(word_count.items(),key=lambda x:x[1],reverse=True) |
| 26 | - | 26 | + # list_count = [[key, str(value)] for key, value in list_count] |
| 27 | + # return list_count | ||
| 27 | for i in range(100): | 28 | for i in range(100): |
| 28 | print(list_count[i],file=result) | 29 | print(list_count[i],file=result) |
| 29 | 30 | ||
| 30 | if __name__ == '__main__': | 31 | if __name__ == '__main__': |
| 31 | - main() | ||
| 32 | + print(main()) |
| @@ -44,15 +44,22 @@ def mergeTopics(article_topics, comment_topics):# 合并话题 | @@ -44,15 +44,22 @@ def mergeTopics(article_topics, comment_topics):# 合并话题 | ||
| 44 | merged_dict[topic['name']] += topic['value'] | 44 | merged_dict[topic['name']] += topic['value'] |
| 45 | else: | 45 | else: |
| 46 | merged_dict[topic['name']] = topic['value'] | 46 | merged_dict[topic['name']] = topic['value'] |
| 47 | - merged_list = [{'name': key, 'value': value} for key, value in merged_dict.items()] | 47 | + merged_dict = sorted(merged_dict.items(), key=lambda item: item[1], reverse=True) |
| 48 | + merged_list = [[key, str(value)] for key, value in merged_dict] | ||
| 48 | return merged_list | 49 | return merged_list |
| 49 | -def getTopicData(): | ||
| 50 | - # 读取合并文件 merge.csv # 取前十个话题 | ||
| 51 | - top_10_topics = pd.read_csv('./merged_topics.csv').head(10) | ||
| 52 | - # 获取话题名称和对应的值 | ||
| 53 | - X = top_10_topics['name'].tolist() | ||
| 54 | - Y = top_10_topics['value'].tolist() | ||
| 55 | - return X, Y | 50 | +def getAllTopicData(): |
| 51 | + # 读取合并文件 merge.csv | ||
| 52 | + # data = [] | ||
| 53 | + # df = pd.read_csv('./merged_topics.csv',encoding='utf8') | ||
| 54 | + # for i in df.values: | ||
| 55 | + # try: | ||
| 56 | + # data.append([ | ||
| 57 | + # re.search('[\u4e00-\u9fa5]+',str(i)).group(), | ||
| 58 | + # re.search('\d+',str(i)).group() | ||
| 59 | + # ]) | ||
| 60 | + # except: | ||
| 61 | + # continue | ||
| 62 | + return mergeTopics(getTopicByArticle(), getTopicByComments()) | ||
| 56 | 63 | ||
| 57 | def getTopicCreatedAtandpredictData(topic):# 统计特定话题的评论在每个日期的数量,并返回日期和对应的评论数量 | 64 | def getTopicCreatedAtandpredictData(topic):# 统计特定话题的评论在每个日期的数量,并返回日期和对应的评论数量 |
| 58 | createdAt = {} | 65 | createdAt = {} |
| @@ -71,9 +78,9 @@ def getTopicCreatedAtandpredictData(topic):# 统计特定话题的评论在每 | @@ -71,9 +78,9 @@ def getTopicCreatedAtandpredictData(topic):# 统计特定话题的评论在每 | ||
| 71 | createdAt = {k: createdAt[k] for k in sorted(createdAt, key=lambda date: datetime.datetime.strptime(date, "%Y-%m-%d"))} | 78 | createdAt = {k: createdAt[k] for k in sorted(createdAt, key=lambda date: datetime.datetime.strptime(date, "%Y-%m-%d"))} |
| 72 | createdAt.update(predict_future_values(createdAt)) | 79 | createdAt.update(predict_future_values(createdAt)) |
| 73 | sorted_data = {k: createdAt[k] for k in sorted(createdAt, key=lambda date: datetime.datetime.strptime(date, "%Y-%m-%d"))} | 80 | sorted_data = {k: createdAt[k] for k in sorted(createdAt, key=lambda date: datetime.datetime.strptime(date, "%Y-%m-%d"))} |
| 74 | - result_list = [0] * (len(sorted_data) - 5) + [1] * 5 | ||
| 75 | - return topic,sorted_data,result_list | ||
| 76 | - # return topic,list(createdAt.keys()),list(createdAt.values()),result_list | 81 | + # result_list = [0] * (len(sorted_data) - 5) + [1] * 5 |
| 82 | + print(list(createdAt.keys()),list(createdAt.values())) | ||
| 83 | + return list(createdAt.keys()),list(createdAt.values()) | ||
| 77 | 84 | ||
| 78 | def writeTopicsToCSV(topics, file_name): | 85 | def writeTopicsToCSV(topics, file_name): |
| 79 | # 检查文件是否存在,如果存在则附加写入,否则新建一个 | 86 | # 检查文件是否存在,如果存在则附加写入,否则新建一个 |
| @@ -91,6 +98,7 @@ def writeTopicsToCSV(topics, file_name): | @@ -91,6 +98,7 @@ def writeTopicsToCSV(topics, file_name): | ||
| 91 | writer.writerow(topic) | 98 | writer.writerow(topic) |
| 92 | if __name__ == '__main__': | 99 | if __name__ == '__main__': |
| 93 | # 将话题数据写入 CSV 文件 | 100 | # 将话题数据写入 CSV 文件 |
| 94 | - # merged_topics = mergeTopics(getTopicByArticle(), getTopicByComments()) | 101 | + # print(mergeTopics(getTopicByArticle(), getTopicByComments())) |
| 95 | # writeTopicsToCSV(merged_topics, 'merged_topics.csv') | 102 | # writeTopicsToCSV(merged_topics, 'merged_topics.csv') |
| 96 | - print(getTopicCreatedAtandpredictData("生活")) | 103 | + print(getAllTopicData()) |
| 104 | + |
| @@ -6,6 +6,8 @@ from utils.getTableData import * | @@ -6,6 +6,8 @@ from utils.getTableData import * | ||
| 6 | from utils.getPublicData import getAllHotWords, getAllTopics | 6 | from utils.getPublicData import getAllHotWords, getAllTopics |
| 7 | from utils.getEchartsData import * | 7 | from utils.getEchartsData import * |
| 8 | from utils.getTopicPageData import * | 8 | from utils.getTopicPageData import * |
| 9 | +from utils.yuqingpredict import * | ||
| 10 | +from utils.getPublicData import getAllHotWords | ||
| 9 | 11 | ||
| 10 | pb = Blueprint('page', | 12 | pb = Blueprint('page', |
| 11 | __name__, | 13 | __name__, |
| @@ -38,6 +40,7 @@ def home(): | @@ -38,6 +40,7 @@ def home(): | ||
| 38 | def hotWord(): | 40 | def hotWord(): |
| 39 | username = session.get('username') | 41 | username = session.get('username') |
| 40 | hotWordList = getAllHotWords() | 42 | hotWordList = getAllHotWords() |
| 43 | + print(hotWordList) | ||
| 41 | defaultHotWord = hotWordList[0][0] | 44 | defaultHotWord = hotWordList[0][0] |
| 42 | if request.args.get('hotWord'): | 45 | if request.args.get('hotWord'): |
| 43 | defaultHotWord = request.args.get('hotWord') | 46 | defaultHotWord = request.args.get('hotWord') |
| @@ -51,7 +54,6 @@ def hotWord(): | @@ -51,7 +54,6 @@ def hotWord(): | ||
| 51 | sentences = '正面' | 54 | sentences = '正面' |
| 52 | elif value < 0.5: | 55 | elif value < 0.5: |
| 53 | sentences = '负面' | 56 | sentences = '负面' |
| 54 | - | ||
| 55 | comments = getCommentFilterData(defaultHotWord) | 57 | comments = getCommentFilterData(defaultHotWord) |
| 56 | return render_template('hotWord.html', | 58 | return render_template('hotWord.html', |
| 57 | username=username, | 59 | username=username, |
| @@ -161,6 +163,34 @@ def yuqingChar(): | @@ -161,6 +163,34 @@ def yuqingChar(): | ||
| 161 | x1Data=x1Data, | 163 | x1Data=x1Data, |
| 162 | y1Data=y1Data) | 164 | y1Data=y1Data) |
| 163 | 165 | ||
| 166 | +@pb.route('/yuqingpredict') | ||
| 167 | +def yuqingpredict(): | ||
| 168 | + username = session.get('username') | ||
| 169 | + TopicList = getAllTopicData() | ||
| 170 | + defaultTopic = TopicList[0][0] | ||
| 171 | + if request.args.get('Topic'): | ||
| 172 | + defaultTopic = request.args.get('Topic') | ||
| 173 | + TopicLen = getTopicLen(defaultTopic) | ||
| 174 | + X, Y = getTopicCreatedAtandpredictData(defaultTopic) | ||
| 175 | + sentences = '' | ||
| 176 | + value = SnowNLP(defaultTopic).sentiments | ||
| 177 | + if value == 0.5: | ||
| 178 | + sentences = '中性' | ||
| 179 | + elif value > 0.5: | ||
| 180 | + sentences = '正面' | ||
| 181 | + elif value < 0.5: | ||
| 182 | + sentences = '负面' | ||
| 183 | + comments = getCommentFilterDataTopic(defaultTopic) | ||
| 184 | + return render_template('yuqingpredict.html', | ||
| 185 | + username=username, | ||
| 186 | + hotWordList=TopicList, | ||
| 187 | + defaultHotWord=defaultTopic, | ||
| 188 | + hotWordLen=TopicLen, | ||
| 189 | + sentences=sentences, | ||
| 190 | + xData=X, | ||
| 191 | + yData=Y, | ||
| 192 | + comments=comments) | ||
| 193 | + | ||
| 164 | 194 | ||
| 165 | @pb.route('/articleCloud') | 195 | @pb.route('/articleCloud') |
| 166 | def articleCloud(): | 196 | def articleCloud(): |
| @@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
| 42 | <li class="px-3 pt-3 pb-2 "> | 42 | <li class="px-3 pt-3 pb-2 "> |
| 43 | <span class="text-uppercase small font-weight-bold">数据可视化</span> | 43 | <span class="text-uppercase small font-weight-bold">数据可视化</span> |
| 44 | </li> | 44 | </li> |
| 45 | - <li class="active sidebar-layout"> | 45 | + <li class=" sidebar-layout"> |
| 46 | <a href="/page/articleChar" class="svg-icon"> | 46 | <a href="/page/articleChar" class="svg-icon"> |
| 47 | <i class=""> | 47 | <i class=""> |
| 48 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 48 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | </i><span class="ml-2">评论分析</span> | 72 | </i><span class="ml-2">评论分析</span> |
| 73 | </a> | 73 | </a> |
| 74 | </li> | 74 | </li> |
| 75 | - <li class=" sidebar-layout"> | 75 | + <li class="active sidebar-layout"> |
| 76 | <a href="/page/yuqingChar" class="svg-icon"> | 76 | <a href="/page/yuqingChar" class="svg-icon"> |
| 77 | <i class=""> | 77 | <i class=""> |
| 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -82,6 +82,16 @@ | @@ -82,6 +82,16 @@ | ||
| 82 | <span class="ml-2">舆情分析</span> | 82 | <span class="ml-2">舆情分析</span> |
| 83 | </a> | 83 | </a> |
| 84 | </li> | 84 | </li> |
| 85 | + <li class="active sidebar-layout"> | ||
| 86 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 87 | + <i class=""> | ||
| 88 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 89 | + <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> | ||
| 90 | + </svg> | ||
| 91 | + </i> | ||
| 92 | + <span class="ml-2">舆情预测</span> | ||
| 93 | + </a> | ||
| 94 | + </li> | ||
| 85 | <li class="px-3 pt-3 pb-2"> | 95 | <li class="px-3 pt-3 pb-2"> |
| 86 | <span class="text-uppercase small font-weight-bold">词云图</span> | 96 | <span class="text-uppercase small font-weight-bold">词云图</span> |
| 87 | </li> | 97 | </li> |
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | </i><span class="ml-2">评论分析</span> | 72 | </i><span class="ml-2">评论分析</span> |
| 73 | </a> | 73 | </a> |
| 74 | </li> | 74 | </li> |
| 75 | - <li class=" sidebar-layout"> | 75 | + <li class="active sidebar-layout"> |
| 76 | <a href="/page/yuqingChar" class="svg-icon"> | 76 | <a href="/page/yuqingChar" class="svg-icon"> |
| 77 | <i class=""> | 77 | <i class=""> |
| 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -82,10 +82,20 @@ | @@ -82,10 +82,20 @@ | ||
| 82 | <span class="ml-2">舆情分析</span> | 82 | <span class="ml-2">舆情分析</span> |
| 83 | </a> | 83 | </a> |
| 84 | </li> | 84 | </li> |
| 85 | + <li class="active sidebar-layout"> | ||
| 86 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 87 | + <i class=""> | ||
| 88 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 89 | + <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> | ||
| 90 | + </svg> | ||
| 91 | + </i> | ||
| 92 | + <span class="ml-2">舆情预测</span> | ||
| 93 | + </a> | ||
| 94 | + </li> | ||
| 85 | <li class="px-3 pt-3 pb-2"> | 95 | <li class="px-3 pt-3 pb-2"> |
| 86 | <span class="text-uppercase small font-weight-bold">词云图</span> | 96 | <span class="text-uppercase small font-weight-bold">词云图</span> |
| 87 | </li> | 97 | </li> |
| 88 | - <li class="active sidebar-layout"> | 98 | + <li class=" sidebar-layout"> |
| 89 | <a href="/page/articleCloud" class="svg-icon"> | 99 | <a href="/page/articleCloud" class="svg-icon"> |
| 90 | <i class=""> | 100 | <i class=""> |
| 91 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 101 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
| 38 | <li class="px-3 pt-3 pb-2 "> | 38 | <li class="px-3 pt-3 pb-2 "> |
| 39 | <span class="text-uppercase small font-weight-bold">首页</span> | 39 | <span class="text-uppercase small font-weight-bold">首页</span> |
| 40 | </li> | 40 | </li> |
| 41 | - <li class="active sidebar-layout"> | 41 | + <li class=" sidebar-layout"> |
| 42 | <a href="/page/home" class="svg-icon"> | 42 | <a href="/page/home" class="svg-icon"> |
| 43 | <i class=""> | 43 | <i class=""> |
| 44 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 44 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -101,7 +101,7 @@ | @@ -101,7 +101,7 @@ | ||
| 101 | </i><span class="ml-2">评论分析</span> | 101 | </i><span class="ml-2">评论分析</span> |
| 102 | </a> | 102 | </a> |
| 103 | </li> | 103 | </li> |
| 104 | - <li class=" sidebar-layout"> | 104 | + <li class="active sidebar-layout"> |
| 105 | <a href="/page/yuqingChar" class="svg-icon"> | 105 | <a href="/page/yuqingChar" class="svg-icon"> |
| 106 | <i class=""> | 106 | <i class=""> |
| 107 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 107 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -111,8 +111,18 @@ | @@ -111,8 +111,18 @@ | ||
| 111 | <span class="ml-2">舆情分析</span> | 111 | <span class="ml-2">舆情分析</span> |
| 112 | </a> | 112 | </a> |
| 113 | </li> | 113 | </li> |
| 114 | + <li class="active sidebar-layout"> | ||
| 115 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 116 | + <i class=""> | ||
| 117 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 118 | + <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> | ||
| 119 | + </svg> | ||
| 120 | + </i> | ||
| 121 | + <span class="ml-2">舆情预测</span> | ||
| 122 | + </a> | ||
| 123 | + </li> | ||
| 114 | <li class="px-3 pt-3 pb-2"> | 124 | <li class="px-3 pt-3 pb-2"> |
| 115 | - <span class="text-uppercase small font-weight-bold">机器学习预测</span> | 125 | + <span class="text-uppercase small font-weight-bold">词云图</span> |
| 116 | </li> | 126 | </li> |
| 117 | <li class=" sidebar-layout"> | 127 | <li class=" sidebar-layout"> |
| 118 | <a href="/page/articleCloud" class="svg-icon"> | 128 | <a href="/page/articleCloud" class="svg-icon"> |
| @@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
| 63 | <span class="ml-2">IP分析</span> | 63 | <span class="ml-2">IP分析</span> |
| 64 | </a> | 64 | </a> |
| 65 | </li> | 65 | </li> |
| 66 | - <li class="active sidebar-layout"> | 66 | + <li class=" sidebar-layout"> |
| 67 | <a href="/page/commentChar" class="svg-icon"> | 67 | <a href="/page/commentChar" class="svg-icon"> |
| 68 | <i class=""> | 68 | <i class=""> |
| 69 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 69 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | </i><span class="ml-2">评论分析</span> | 72 | </i><span class="ml-2">评论分析</span> |
| 73 | </a> | 73 | </a> |
| 74 | </li> | 74 | </li> |
| 75 | - <li class=" sidebar-layout"> | 75 | + <li class="active sidebar-layout"> |
| 76 | <a href="/page/yuqingChar" class="svg-icon"> | 76 | <a href="/page/yuqingChar" class="svg-icon"> |
| 77 | <i class=""> | 77 | <i class=""> |
| 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -82,6 +82,16 @@ | @@ -82,6 +82,16 @@ | ||
| 82 | <span class="ml-2">舆情分析</span> | 82 | <span class="ml-2">舆情分析</span> |
| 83 | </a> | 83 | </a> |
| 84 | </li> | 84 | </li> |
| 85 | + <li class="active sidebar-layout"> | ||
| 86 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 87 | + <i class=""> | ||
| 88 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 89 | + <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> | ||
| 90 | + </svg> | ||
| 91 | + </i> | ||
| 92 | + <span class="ml-2">舆情预测</span> | ||
| 93 | + </a> | ||
| 94 | + </li> | ||
| 85 | <li class="px-3 pt-3 pb-2"> | 95 | <li class="px-3 pt-3 pb-2"> |
| 86 | <span class="text-uppercase small font-weight-bold">词云图</span> | 96 | <span class="text-uppercase small font-weight-bold">词云图</span> |
| 87 | </li> | 97 | </li> |
| @@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
| 2 | {% block title %} | 2 | {% block title %} |
| 3 | 热词统计 | 3 | 热词统计 |
| 4 | {% endblock %} | 4 | {% endblock %} |
| 5 | - | ||
| 6 | {% block nav %} | 5 | {% block nav %} |
| 7 | <nav class="iq-sidebar-menu"> | 6 | <nav class="iq-sidebar-menu"> |
| 8 | <ul id="iq-sidebar-toggle" class="side-menu"> | 7 | <ul id="iq-sidebar-toggle" class="side-menu"> |
| @@ -19,7 +18,7 @@ | @@ -19,7 +18,7 @@ | ||
| 19 | <span class="ml-2">首页</span> | 18 | <span class="ml-2">首页</span> |
| 20 | </a> | 19 | </a> |
| 21 | </li> | 20 | </li> |
| 22 | - <li class="active sidebar-layout"> | 21 | + <li class=" sidebar-layout"> |
| 23 | <a href="/page/hotWord" class="svg-icon "> | 22 | <a href="/page/hotWord" class="svg-icon "> |
| 24 | <i class=""> | 23 | <i class=""> |
| 25 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 24 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -72,7 +71,7 @@ | @@ -72,7 +71,7 @@ | ||
| 72 | </i><span class="ml-2">评论分析</span> | 71 | </i><span class="ml-2">评论分析</span> |
| 73 | </a> | 72 | </a> |
| 74 | </li> | 73 | </li> |
| 75 | - <li class=" sidebar-layout"> | 74 | + <li class="active sidebar-layout"> |
| 76 | <a href="/page/yuqingChar" class="svg-icon"> | 75 | <a href="/page/yuqingChar" class="svg-icon"> |
| 77 | <i class=""> | 76 | <i class=""> |
| 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 77 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -82,6 +81,16 @@ | @@ -82,6 +81,16 @@ | ||
| 82 | <span class="ml-2">舆情分析</span> | 81 | <span class="ml-2">舆情分析</span> |
| 83 | </a> | 82 | </a> |
| 84 | </li> | 83 | </li> |
| 84 | + <li class="active sidebar-layout"> | ||
| 85 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 86 | + <i class=""> | ||
| 87 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 88 | + <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> | ||
| 89 | + </svg> | ||
| 90 | + </i> | ||
| 91 | + <span class="ml-2">舆情预测</span> | ||
| 92 | + </a> | ||
| 93 | + </li> | ||
| 85 | <li class="px-3 pt-3 pb-2"> | 94 | <li class="px-3 pt-3 pb-2"> |
| 86 | <span class="text-uppercase small font-weight-bold">词云图</span> | 95 | <span class="text-uppercase small font-weight-bold">词云图</span> |
| 87 | </li> | 96 | </li> |
| @@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
| 53 | <span class="ml-2">文章分析</span> | 53 | <span class="ml-2">文章分析</span> |
| 54 | </a> | 54 | </a> |
| 55 | </li> | 55 | </li> |
| 56 | - <li class="active sidebar-layout"> | 56 | + <li class=" sidebar-layout"> |
| 57 | <a href="/page/ipChar" class="svg-icon"> | 57 | <a href="/page/ipChar" class="svg-icon"> |
| 58 | <i class=""> | 58 | <i class=""> |
| 59 | <svg class="icon line" width="18" id="receipt" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" stroke="currentColor"> | 59 | <svg class="icon line" width="18" id="receipt" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -73,8 +73,8 @@ | @@ -73,8 +73,8 @@ | ||
| 73 | </i><span class="ml-2">评论分析</span> | 73 | </i><span class="ml-2">评论分析</span> |
| 74 | </a> | 74 | </a> |
| 75 | </li> | 75 | </li> |
| 76 | - <li class=" sidebar-layout"> | ||
| 77 | - <a href="/page/yuqingChar" class="svg-icon"> | 76 | + <li class="active sidebar-layout"> |
| 77 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 78 | <i class=""> | 78 | <i class=""> |
| 79 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 79 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| 80 | <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 | <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> |
| @@ -83,6 +83,16 @@ | @@ -83,6 +83,16 @@ | ||
| 83 | <span class="ml-2">舆情分析</span> | 83 | <span class="ml-2">舆情分析</span> |
| 84 | </a> | 84 | </a> |
| 85 | </li> | 85 | </li> |
| 86 | + <li class="active sidebar-layout"> | ||
| 87 | + <a href="/page/yuqingChar" class="svg-icon"> | ||
| 88 | + <i class=""> | ||
| 89 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 90 | + <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> | ||
| 91 | + </svg> | ||
| 92 | + </i> | ||
| 93 | + <span class="ml-2">舆情预测</span> | ||
| 94 | + </a> | ||
| 95 | + </li> | ||
| 86 | <li class="px-3 pt-3 pb-2"> | 96 | <li class="px-3 pt-3 pb-2"> |
| 87 | <span class="text-uppercase small font-weight-bold">词云图</span> | 97 | <span class="text-uppercase small font-weight-bold">词云图</span> |
| 88 | </li> | 98 | </li> |
| @@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
| 29 | <span class="ml-2">热词统计</span> | 29 | <span class="ml-2">热词统计</span> |
| 30 | </a> | 30 | </a> |
| 31 | </li> | 31 | </li> |
| 32 | - <li class="active sidebar-layout"> | 32 | + <li class=" sidebar-layout"> |
| 33 | <a href="/page/tableData" class="svg-icon"> | 33 | <a href="/page/tableData" class="svg-icon"> |
| 34 | <i class=""> | 34 | <i class=""> |
| 35 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 35 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -72,7 +72,7 @@ | @@ -72,7 +72,7 @@ | ||
| 72 | </i><span class="ml-2">评论分析</span> | 72 | </i><span class="ml-2">评论分析</span> |
| 73 | </a> | 73 | </a> |
| 74 | </li> | 74 | </li> |
| 75 | - <li class=" sidebar-layout"> | 75 | + <li class="active sidebar-layout"> |
| 76 | <a href="/page/yuqingChar" class="svg-icon"> | 76 | <a href="/page/yuqingChar" class="svg-icon"> |
| 77 | <i class=""> | 77 | <i class=""> |
| 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | 78 | <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> |
| @@ -82,6 +82,16 @@ | @@ -82,6 +82,16 @@ | ||
| 82 | <span class="ml-2">舆情分析</span> | 82 | <span class="ml-2">舆情分析</span> |
| 83 | </a> | 83 | </a> |
| 84 | </li> | 84 | </li> |
| 85 | + <li class="active sidebar-layout"> | ||
| 86 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 87 | + <i class=""> | ||
| 88 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 89 | + <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> | ||
| 90 | + </svg> | ||
| 91 | + </i> | ||
| 92 | + <span class="ml-2">舆情预测</span> | ||
| 93 | + </a> | ||
| 94 | + </li> | ||
| 85 | <li class="px-3 pt-3 pb-2"> | 95 | <li class="px-3 pt-3 pb-2"> |
| 86 | <span class="text-uppercase small font-weight-bold">词云图</span> | 96 | <span class="text-uppercase small font-weight-bold">词云图</span> |
| 87 | </li> | 97 | </li> |
| @@ -81,6 +81,16 @@ | @@ -81,6 +81,16 @@ | ||
| 81 | <span class="ml-2">舆情分析</span> | 81 | <span class="ml-2">舆情分析</span> |
| 82 | </a> | 82 | </a> |
| 83 | </li> | 83 | </li> |
| 84 | + <li class="active sidebar-layout"> | ||
| 85 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 86 | + <i class=""> | ||
| 87 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 88 | + <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> | ||
| 89 | + </svg> | ||
| 90 | + </i> | ||
| 91 | + <span class="ml-2">舆情预测</span> | ||
| 92 | + </a> | ||
| 93 | + </li> | ||
| 84 | <li class="px-3 pt-3 pb-2"> | 94 | <li class="px-3 pt-3 pb-2"> |
| 85 | <span class="text-uppercase small font-weight-bold">词云图</span> | 95 | <span class="text-uppercase small font-weight-bold">词云图</span> |
| 86 | </li> | 96 | </li> |
views/page/templates/yuqingpredict.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="active sidebar-layout"> | ||
| 85 | + <a href="/page/yuqingpredict" class="svg-icon"> | ||
| 86 | + <i class=""> | ||
| 87 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 88 | + <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> | ||
| 89 | + </svg> | ||
| 90 | + </i> | ||
| 91 | + <span class="ml-2">舆情预测</span> | ||
| 92 | + </a> | ||
| 93 | + </li> | ||
| 94 | + <li class="px-3 pt-3 pb-2"> | ||
| 95 | + <span class="text-uppercase small font-weight-bold">词云图</span> | ||
| 96 | + </li> | ||
| 97 | + <li class=" sidebar-layout"> | ||
| 98 | + <a href="/page/articleCloud" class="svg-icon"> | ||
| 99 | + <i class=""> | ||
| 100 | + <svg xmlns="http://www.w3.org/2000/svg" width="18" fill="none" viewbox="0 0 24 24" stroke="currentColor"> | ||
| 101 | + <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> | ||
| 102 | + </svg> | ||
| 103 | + </i><span class="ml-2">文章内容词云图</span> | ||
| 104 | + </a> | ||
| 105 | + </li> | ||
| 106 | + </ul> | ||
| 107 | + </nav> | ||
| 108 | +{% endblock %} | ||
| 109 | +{% block content %} | ||
| 110 | + <div class="container-fluid"> | ||
| 111 | + <div class="row"> | ||
| 112 | + <div class="col-md-12 mb-4 mt-1"> | ||
| 113 | + <div class="d-flex flex-wrap justify-content-between align-items-center"> | ||
| 114 | + <h4 class="font-weight-bold">话题统计页</h4> | ||
| 115 | + </div> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + <div class="row"> | ||
| 119 | + <div class="col-lg-12"> | ||
| 120 | + <div class="card card-block card-stretch card-height"> | ||
| 121 | + <div class="card-body"> | ||
| 122 | + <div class="collapse" id="form-element-15"> | ||
| 123 | + <div class="card"><kbd class="bg-dark"><pre id="select-size" class="text-white"><code> | ||
| 124 | +<div class="form-group"> | ||
| 125 | + <label>Small</label> | ||
| 126 | + <select class="form-control form-control-sm 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>Default</label> | ||
| 135 | + <select class="form-control mb-3"> | ||
| 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 | +<div class="form-group"> | ||
| 143 | + <label>Large</label> | ||
| 144 | + <select class="form-control form-control-lg"> | ||
| 145 | + <option selected="">Open this select menu</option> | ||
| 146 | + <option value="1">One</option> | ||
| 147 | + <option value="2">Two</option> | ||
| 148 | + <option value="3">Three</option> | ||
| 149 | + </select> | ||
| 150 | +</div> | ||
| 151 | +</code></pre></kbd></div> | ||
| 152 | + </div> | ||
| 153 | + <div class="form-group"> | ||
| 154 | + <label>话题选择</label> | ||
| 155 | + <select onchange="hotWordChange(event)" class="form-control mb-3"> | ||
| 156 | + {% for i in hotWordList %} | ||
| 157 | + {% if defaultHotWord == i[0] %} | ||
| 158 | + <option selected value="{{ i[0] }}">{{ i[0] }}</option> | ||
| 159 | + {% else %} | ||
| 160 | + <option value="{{ i[0] }}">{{ i[0] }}</option> | ||
| 161 | + {% endif %} | ||
| 162 | + {% endfor %} | ||
| 163 | + </select> | ||
| 164 | + <script> | ||
| 165 | + function hotWordChange(e){ | ||
| 166 | + window.location.href = 'http://127.0.0.1:5000/page/yuqingpredict?Topic=' + e.target.value | ||
| 167 | + } | ||
| 168 | + </script> | ||
| 169 | + </div> | ||
| 170 | + </div> | ||
| 171 | + </div> | ||
| 172 | + | ||
| 173 | + </div> | ||
| 174 | + </div> | ||
| 175 | + <div class="row" style="justify-content: center"> | ||
| 176 | + <div class="col-md-6 col-xl-6"> | ||
| 177 | + <div class="card"> | ||
| 178 | + <div class="card-body"> | ||
| 179 | + <h4 class="card-title font-size-16 mt-0">{{ defaultHotWord }}</h4> | ||
| 180 | + </div> | ||
| 181 | + <ul class="list-group list-group-flush"> | ||
| 182 | + <li class="list-group-item">话题名称:{{ defaultHotWord }}</li> | ||
| 183 | + <li class="list-group-item">出现次数:{{ hotWordLen }}次</li> | ||
| 184 | + <li class="list-group-item">话题情感:{{ sentences }}</li> | ||
| 185 | + </ul> | ||
| 186 | + </div> | ||
| 187 | + | ||
| 188 | + </div> | ||
| 189 | + </div> | ||
| 190 | + <div class="row"> | ||
| 191 | + <div class="col-lg-12"> | ||
| 192 | + <div class="card"> | ||
| 193 | + <div class="card-body"> | ||
| 194 | + <h4 class="card-title font-size-16 mt-0">话题年份变化趋势</h4> | ||
| 195 | + </div> | ||
| 196 | + <div id="main" style="width:100%;height: 450px"></div> | ||
| 197 | + </div> | ||
| 198 | + </div> | ||
| 199 | + </div> | ||
| 200 | + <div class="row"> | ||
| 201 | + <div class="col-lg-12"> | ||
| 202 | + <div class="card"> | ||
| 203 | + <div class="card-header d-flex justify-content-between"> | ||
| 204 | + <div class="header-title"> | ||
| 205 | + <h4 class="card-title">话题查询表格</h4> | ||
| 206 | + </div> | ||
| 207 | + <div class="header-action"> | ||
| 208 | + <i data-toggle="collapse" data-target="#datatable-1" aria-expanded="false"> | ||
| 209 | + <svg width="20" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | ||
| 210 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"></path> | ||
| 211 | + </svg> | ||
| 212 | + </i> | ||
| 213 | + </div> | ||
| 214 | + </div> | ||
| 215 | + <div class="card-body"> | ||
| 216 | + <div class="collapse" id="datatable-1"> | ||
| 217 | + <div class="card"><kbd class="bg-dark"> | ||
| 218 | + <pre id="bootstrap-datatables" class="text-white"><code> | ||
| 219 | +<table id="datatable" class="table data-table table-striped table-bordered" > | ||
| 220 | + <thead> | ||
| 221 | + <tr> | ||
| 222 | + <th>Name</th> | ||
| 223 | + <th>Position</th> | ||
| 224 | + <th>Office</th> | ||
| 225 | + <th>Age</th> | ||
| 226 | + <th>Start date</th> | ||
| 227 | + <th>Salary</th> | ||
| 228 | + </tr> | ||
| 229 | + </thead> | ||
| 230 | + <tbody> | ||
| 231 | + <tr> | ||
| 232 | + <td>Tiger Nixon</td> | ||
| 233 | + <td>System Architect</td> | ||
| 234 | + <td>Edinburgh</td> | ||
| 235 | + <td>61</td> | ||
| 236 | + <td>2011/04/25</td> | ||
| 237 | + <td>$320,800</td> | ||
| 238 | + </tr> | ||
| 239 | + <tr> | ||
| 240 | + <td>Garrett Winters</td> | ||
| 241 | + <td>Accountant</td> | ||
| 242 | + <td>Tokyo</td> | ||
| 243 | + <td>63</td> | ||
| 244 | + <td>2011/07/25</td> | ||
| 245 | + <td>$170,750</td> | ||
| 246 | + </tr> | ||
| 247 | + <tr> | ||
| 248 | + <td>Ashton Cox</td> | ||
| 249 | + <td>Junior Technical Author</td> | ||
| 250 | + <td>San Francisco</td> | ||
| 251 | + <td>66</td> | ||
| 252 | + <td>2009/01/12</td> | ||
| 253 | + <td>$86,000</td> | ||
| 254 | + </tr> | ||
| 255 | + <tr> | ||
| 256 | + <td>Cedric Kelly</td> | ||
| 257 | + <td>Senior Javascript Developer</td> | ||
| 258 | + <td>Edinburgh</td> | ||
| 259 | + <td>22</td> | ||
| 260 | + <td>2012/03/29</td> | ||
| 261 | + <td>$433,060</td> | ||
| 262 | + </tr> | ||
| 263 | + <tr> | ||
| 264 | + <td>Airi Satou</td> | ||
| 265 | + <td>Accountant</td> | ||
| 266 | + <td>Tokyo</td> | ||
| 267 | + <td>33</td> | ||
| 268 | + <td>2008/11/28</td> | ||
| 269 | + <td>$162,700</td> | ||
| 270 | + </tr> | ||
| 271 | + <tr> | ||
| 272 | + <td>Brielle Williamson</td> | ||
| 273 | + <td>Integration Specialist</td> | ||
| 274 | + <td>New York</td> | ||
| 275 | + <td>61</td> | ||
| 276 | + <td>2012/12/02</td> | ||
| 277 | + <td>$372,000</td> | ||
| 278 | + </tr> | ||
| 279 | + <tr> | ||
| 280 | + <td>Herrod Chandler</td> | ||
| 281 | + <td>Sales Assistant</td> | ||
| 282 | + <td>San Francisco</td> | ||
| 283 | + <td>59</td> | ||
| 284 | + <td>2012/08/06</td> | ||
| 285 | + <td>$137,500</td> | ||
| 286 | + </tr> | ||
| 287 | + <tr> | ||
| 288 | + <td>Rhona Davidson</td> | ||
| 289 | + <td>Integration Specialist</td> | ||
| 290 | + <td>Tokyo</td> | ||
| 291 | + <td>55</td> | ||
| 292 | + <td>2010/10/14</td> | ||
| 293 | + <td>$327,900</td> | ||
| 294 | + </tr> | ||
| 295 | + <tr> | ||
| 296 | + <td>Colleen Hurst</td> | ||
| 297 | + <td>Javascript Developer</td> | ||
| 298 | + <td>San Francisco</td> | ||
| 299 | + <td>39</td> | ||
| 300 | + <td>2009/09/15</td> | ||
| 301 | + <td>$205,500</td> | ||
| 302 | + </tr> | ||
| 303 | + <tr> | ||
| 304 | + <td>Sonya Frost</td> | ||
| 305 | + <td>Software Engineer</td> | ||
| 306 | + <td>Edinburgh</td> | ||
| 307 | + <td>23</td> | ||
| 308 | + <td>2008/12/13</td> | ||
| 309 | + <td>$103,600</td> | ||
| 310 | + </tr> | ||
| 311 | + <tr> | ||
| 312 | + <td>Jena Gaines</td> | ||
| 313 | + <td>Office Manager</td> | ||
| 314 | + <td>London</td> | ||
| 315 | + <td>30</td> | ||
| 316 | + <td>2008/12/19</td> | ||
| 317 | + <td>$90,560</td> | ||
| 318 | + </tr> | ||
| 319 | + <tr> | ||
| 320 | + <td>Quinn Flynn</td> | ||
| 321 | + <td>Support Lead</td> | ||
| 322 | + <td>Edinburgh</td> | ||
| 323 | + <td>22</td> | ||
| 324 | + <td>2013/03/03</td> | ||
| 325 | + <td>$342,000</td> | ||
| 326 | + </tr> | ||
| 327 | + <tr> | ||
| 328 | + <td>Charde Marshall</td> | ||
| 329 | + <td>Regional Director</td> | ||
| 330 | + <td>San Francisco</td> | ||
| 331 | + <td>36</td> | ||
| 332 | + <td>2008/10/16</td> | ||
| 333 | + <td>$470,600</td> | ||
| 334 | + </tr> | ||
| 335 | + <tr> | ||
| 336 | + <td>Haley Kennedy</td> | ||
| 337 | + <td>Senior Marketing Designer</td> | ||
| 338 | + <td>London</td> | ||
| 339 | + <td>43</td> | ||
| 340 | + <td>2012/12/18</td> | ||
| 341 | + <td>$313,500</td> | ||
| 342 | + </tr> | ||
| 343 | + <tr> | ||
| 344 | + <td>Tatyana Fitzpatrick</td> | ||
| 345 | + <td>Regional Director</td> | ||
| 346 | + <td>London</td> | ||
| 347 | + <td>19</td> | ||
| 348 | + <td>2010/03/17</td> | ||
| 349 | + <td>$385,750</td> | ||
| 350 | + </tr> | ||
| 351 | + <tr> | ||
| 352 | + <td>Michael Silva</td> | ||
| 353 | + <td>Marketing Designer</td> | ||
| 354 | + <td>London</td> | ||
| 355 | + <td>66</td> | ||
| 356 | + <td>2012/11/27</td> | ||
| 357 | + <td>$198,500</td> | ||
| 358 | + </tr> | ||
| 359 | + <tr> | ||
| 360 | + <td>Paul Byrd</td> | ||
| 361 | + <td>Chief Financial Officer (CFO)</td> | ||
| 362 | + <td>New York</td> | ||
| 363 | + <td>64</td> | ||
| 364 | + <td>2010/06/09</td> | ||
| 365 | + <td>$725,000</td> | ||
| 366 | + </tr> | ||
| 367 | + <tr> | ||
| 368 | + <td>Gloria Little</td> | ||
| 369 | + <td>Systems Administrator</td> | ||
| 370 | + <td>New York</td> | ||
| 371 | + <td>59</td> | ||
| 372 | + <td>2009/04/10</td> | ||
| 373 | + <td>$237,500</td> | ||
| 374 | + </tr> | ||
| 375 | + <tr> | ||
| 376 | + <td>Bradley Greer</td> | ||
| 377 | + <td>Software Engineer</td> | ||
| 378 | + <td>London</td> | ||
| 379 | + <td>41</td> | ||
| 380 | + <td>2012/10/13</td> | ||
| 381 | + <td>$132,000</td> | ||
| 382 | + </tr> | ||
| 383 | + <tr> | ||
| 384 | + <td>Dai Rios</td> | ||
| 385 | + <td>Personnel Lead</td> | ||
| 386 | + <td>Edinburgh</td> | ||
| 387 | + <td>35</td> | ||
| 388 | + <td>2012/09/26</td> | ||
| 389 | + <td>$217,500</td> | ||
| 390 | + </tr> | ||
| 391 | +</table> | ||
| 392 | +</code></pre></kbd></div> | ||
| 393 | + </div> | ||
| 394 | + <p>根据选择的话题从而查询出评论数据</p> | ||
| 395 | + <div class="table-responsive"> | ||
| 396 | + <div id="datatable-1_wrapper" class="dataTables_wrapper dt-bootstrap4"> | ||
| 397 | + <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"> | ||
| 398 | + <thead> | ||
| 399 | + <tr role="row"> | ||
| 400 | + <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> | ||
| 401 | + <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> | ||
| 402 | + <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> | ||
| 403 | + <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> | ||
| 404 | + <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> | ||
| 405 | + <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> | ||
| 406 | + </thead> | ||
| 407 | + <tbody> | ||
| 408 | + {% for i in comments %} | ||
| 409 | + <tr class="odd"> | ||
| 410 | + <td class="sorting_1">{{ i[0] }}</td> | ||
| 411 | + <td>{{ i[5] }}</td> | ||
| 412 | + <td> | ||
| 413 | + {% if i[6] =='f' %} | ||
| 414 | + 女生 | ||
| 415 | + {% else %} | ||
| 416 | + 男生 | ||
| 417 | + {% endif %} | ||
| 418 | + </td> | ||
| 419 | + <td>{{ i[9] }}</td> | ||
| 420 | + <td>{{ i[4] }}</td> | ||
| 421 | + <td class="text-right">👍{{ i[2] }}</td> | ||
| 422 | + </tr> | ||
| 423 | + {% endfor %} | ||
| 424 | + </tbody> | ||
| 425 | + </table></div></div> | ||
| 426 | + </div> | ||
| 427 | + </div> | ||
| 428 | + </div> | ||
| 429 | + </div> | ||
| 430 | + </div> | ||
| 431 | +</div> | ||
| 432 | + | ||
| 433 | +{% endblock %} | ||
| 434 | + | ||
| 435 | +{% block echarts %} | ||
| 436 | +<script> | ||
| 437 | + var yData = {{ yData | tojson }}; | ||
| 438 | + var xData = {{ xData | tojson }}; | ||
| 439 | + | ||
| 440 | + var chartDom = document.getElementById('main'); | ||
| 441 | + var myChart = echarts.init(chartDom); | ||
| 442 | + var option; | ||
| 443 | + | ||
| 444 | + var lastFiveStartIndex = yData.length - 5; // 最后五个数据点的开始索引 | ||
| 445 | + | ||
| 446 | + option = { | ||
| 447 | + tooltip: { | ||
| 448 | + trigger: 'axis' | ||
| 449 | + }, | ||
| 450 | + legend: { | ||
| 451 | + data: ['话题出现时间分布个数', '话题预测时间分布个数'] | ||
| 452 | + }, | ||
| 453 | + toolbox: { | ||
| 454 | + show: true, | ||
| 455 | + feature: { | ||
| 456 | + dataView: { show: true, readOnly: false }, | ||
| 457 | + magicType: { show: true, type: ['line', 'bar'] }, | ||
| 458 | + restore: { show: true }, | ||
| 459 | + saveAsImage: { show: true } | ||
| 460 | + } | ||
| 461 | + }, | ||
| 462 | + calculable: true, | ||
| 463 | + xAxis: [ | ||
| 464 | + { | ||
| 465 | + type: 'category', | ||
| 466 | + data: xData | ||
| 467 | + } | ||
| 468 | + ], | ||
| 469 | + yAxis: [ | ||
| 470 | + { | ||
| 471 | + type: 'value' | ||
| 472 | + } | ||
| 473 | + ], | ||
| 474 | + dataZoom: [ | ||
| 475 | + { | ||
| 476 | + show: true, | ||
| 477 | + start: 10, | ||
| 478 | + end: 60 | ||
| 479 | + }, | ||
| 480 | + { | ||
| 481 | + type: 'inside', | ||
| 482 | + start: 10, | ||
| 483 | + end: 60 | ||
| 484 | + } | ||
| 485 | + ], | ||
| 486 | + series: [ | ||
| 487 | + { | ||
| 488 | + name: '话题预测时间分布个数', | ||
| 489 | + type: 'bar', | ||
| 490 | + data: yData.map((value, index) => ({ | ||
| 491 | + value: value, | ||
| 492 | + itemStyle: { | ||
| 493 | + color: index >= lastFiveStartIndex ? 'orange' : 'blue' | ||
| 494 | + } | ||
| 495 | + })), | ||
| 496 | + markPoint: { | ||
| 497 | + data: [ | ||
| 498 | + { type: 'max', name: 'Max' }, | ||
| 499 | + { type: 'min', name: 'Min' } | ||
| 500 | + ] | ||
| 501 | + }, | ||
| 502 | + markLine: { | ||
| 503 | + data: [{ type: 'average', name: 'Avg' }] | ||
| 504 | + } | ||
| 505 | + } | ||
| 506 | + ] | ||
| 507 | + }; | ||
| 508 | + | ||
| 509 | + myChart.setOption(option); | ||
| 510 | +</script> | ||
| 511 | + | ||
| 512 | +{% endblock %} |
-
Please register or login to post a comment