diff --git a/web_app_django/tweet/templates/index.html b/web_app_django/tweet/templates/index.html index 92f7a048c91f742a17722b89d67ca401ff7e3832..0c883295fca2672d9b7ce7694c74ac9f72da615b 100644 --- a/web_app_django/tweet/templates/index.html +++ b/web_app_django/tweet/templates/index.html @@ -1,91 +1,10 @@ {% load static %} <!DOCTYPE html> <html lang="zh-CN"> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>鼠标事件</title> - <link href="http://a.amap.com/Loca/static/manual/example/style/demo.css" rel="stylesheet"> - <style> - html, - body, - #container { - margin: 0; - padding: 0; - width: 100%; - height: 100%; - } - </style> -</head> -<body> -<div id="container" class="container"> -</div> -<!--<script src="./script/loca.js"></script>--> -<script src="http://webapi.amap.com/loca?v=1.2.0&key=393144ee0738b91f3e93b0c6d0c36562"></script> -<script src="http://a.amap.com/Loca/static/manual/example/script/demo.js"></script> -<!-- <script src=".\infoshow.js"></script> --> -<script src="./district.js"></script> -<script> - var map = Loca.create('container', { - mapStyle: 'amap://styles/e32987d0e34dadd472724015bb64a0f8', - zoom: 4, - center: [135, -28] - }); - var layer = Loca.visualLayer({ - eventSupport: true, // selectStyle 配置需要开启 eventSupport: true - container: map, - type: 'point', - shape: 'circle' - }); - - - layer.on('mousemove', function (ev) { - // 事件类型 - var type = ev.type; - // 当前元素的原始数据 - var rawData = ev.rawData; - - // 原始鼠标事件 - var originalEvent = ev.originalEvent; - - openInfoWin(map.getMap(), originalEvent, { - 'City': rawData.name, - 'Location': rawData.center - }); - }); - - layer.on('mouseleave', function (ev) { - closeInfoWin(); - }); - - layer.setData(districts, { - lnglat: 'center' - }); - - layer.setOptions({ - style: { - radius: 5, - color: '#4fc2ff', - borderColor: '#ffffff', - borderWidth: 1.5, - opacity: 0.8 - }, - selectStyle: { - radius: 14, - color: '#ffe30a' - } - }); - - layer.render(); - - - -</script> - <hr> + <body> {% if cityInfo %} {% for city in cityInfo %} @@ -106,8 +25,8 @@ <td>{{VicCount}}</td> <td>{{SacCount}}</td> - + </body> - </body> </html> \ No newline at end of file + </html> \ No newline at end of file diff --git a/web_app_django/tweet/views.py b/web_app_django/tweet/views.py index eeff1aa904cfd5b40e34b66bfe791a65707915ae..5f13fa02bf15b0eabb7b272698d0c7eccd8dc098 100644 --- a/web_app_django/tweet/views.py +++ b/web_app_django/tweet/views.py @@ -39,13 +39,14 @@ def index(request): percentage = str(round(number,2))+"%" #print(percentage) cityPercentage[data.key] = percentage + cityTotal.append(cityPercentage) #print(cityTotal) #print(cityInfo) - context = cityPercentage + context = {'cityTotal':cityTotal} context = {'cityInfo':cityInfo} docsNsw = SERVER['aurin_nsw']