Your Name 3 년 전
부모
커밋
31f0bf0458
2개의 변경된 파일38개의 추가작업 그리고 5개의 파일을 삭제
  1. 35 4
      similar_web/index3.html
  2. 3 1
      similar_web/main.py

+ 35 - 4
similar_web/index3.html

@@ -217,6 +217,14 @@
       </div>
     </div>
   </div>
+
+
+  <div class="card card__notHover">
+    <div id="main" class="chart"></div>
+  </div>
+
+
+
   <footer class="footer text-center p-4 bg-white">
     <div class="text-muted"> © 2021 Copyright: Googo Website Traffic</div>
   </footer>
@@ -276,13 +284,36 @@
       dataOBJ = { 'keyword': $('#search_query').val() }
 //      alert(dataOBJ)
       objstr = JSON.stringify(dataOBJ);
-      console.log(objstr)
+      console.log(objstr);
       $.get("http://api.ptt.cx:8080/keyword/"+$('#search_query').val(), function (result) {
 
         console.log(result);
-        $('#globalrank').html(result.msearch)
-        $('#countryrank').html(result.msearch)
-        $('#category').html(result.msearch)
+        $('#globalrank').html(result.msearch);
+        $('#countryrank').html(result.msearch);
+        $('#category').html(result.msearch);
+
+        option = {
+tooltip: {
+  trigger: 'axis'
+},
+xAxis: {
+  type: 'category',
+  boundaryGap: false,
+  data: key_ary
+},
+yAxis: {
+  type: 'value'
+},
+series: [{
+  data: val_ary,
+  type: 'line',
+  areaStyle: {},
+
+}]
+};
+myChart.setOption(option);
+
+
 
 //        alert(result.competition)
 

+ 3 - 1
similar_web/main.py

@@ -108,7 +108,9 @@ async def keyword(keyword):
 
     competition=list_keywords[0].keyword_idea_metrics.competition.name
     msearch=list_keywords[0].keyword_idea_metrics.avg_monthly_searches
+    months=[]
     for v in list_keywords[0].keyword_idea_metrics.monthly_search_volumes:
+        months.append({'year':v.year,'month':v.month.replace('MonthOfYear.',''),'vol':v.monthly_searches})
         print(v.month)
         print(v.year)
         print(v.monthly_searches)
@@ -123,7 +125,7 @@ async def keyword(keyword):
     
 #    print(list_keywords[0]['text'])
 #    print(list_keywords[0]['competition'])
-    return {'competition':competition,'msearch':msearch}
+    return {'competition':competition,'msearch':msearch,'months':months}