File tree 5 files changed +67
-18
lines changed
5 files changed +67
-18
lines changed Original file line number Diff line number Diff line change @@ -43,9 +43,9 @@ function drawBarChart(divid, data){
43
43
44
44
var margin = {
45
45
top : 15 ,
46
- right : 70 ,
46
+ right : 90 ,
47
47
bottom : 15 ,
48
- left : 200
48
+ left : 300
49
49
} ;
50
50
51
51
var width = 960 - margin . left - margin . right ,
Original file line number Diff line number Diff line change 6
6
.arc path {
7
7
stroke : # fff ;
8
8
}
9
- .display {
9
+ .display-none {
10
+ display : none;
11
+ }
12
+ .display-flex {
10
13
display : flex;
11
14
flex-direction : row;
12
15
}
13
- .text-size {
14
- font-size : 20px ;
15
- }
16
16
.text-color {
17
17
color : red;
18
18
}
19
19
.body {
20
20
text-align : center;
21
21
font-family : sans-serif;
22
22
}
23
+ .button-styling {
24
+ font-size : 15px ;
25
+ background-color : # 2F4F4F ;
26
+ color : white;
27
+ font-style : oblique 0deg ;
28
+ width : 300px ;
29
+ height : 50px ;
30
+ border-radius : 6px ;
31
+ border-size : 2px ;
32
+ text-shadow : -2px 0px ;
33
+ }
34
+ input {
35
+ border-radius : 6px ;
36
+ border-size : 2px ;
37
+ width : 300px ;
38
+ height : 50px ;
39
+ vertical-align : top;
40
+ }
41
+ .blink_text {
42
+
43
+ animation : 1s blinker linear infinite;
44
+ -webkit-animation : 1s blinker linear infinite;
45
+ -moz-animation : 1s blinker linear infinite;
46
+
47
+ color : red;
48
+ }
49
+
50
+ @-moz-keyframes blinker {
51
+ 0% { opacity : 1.0 ; }
52
+ 50% { opacity : 0.0 ; }
53
+ 100% { opacity : 1.0 ; }
54
+ }
55
+
56
+ @-webkit-keyframes blinker {
57
+ 0% { opacity : 1.0 ; }
58
+ 50% { opacity : 0.0 ; }
59
+ 100% { opacity : 1.0 ; }
60
+ }
61
+
62
+ @keyframes blinker {
63
+ 0% { opacity : 1.0 ; }
64
+ 50% { opacity : 0.0 ; }
65
+ 100% { opacity : 1.0 ; }
66
+ }
Original file line number Diff line number Diff line change 7
7
</ head >
8
8
< body class ="body ">
9
9
< h1 > Welcome to the UK Crime Stats site</ h1 >
10
- < form action ="{{ url_for('viewcrime') }} " method = 'POST '>
11
- < label for ="keyword " class ="keyword "> Enter an address in the UK:</ label >
12
- < input type = 'text ' name ='location ' placeholder ='Enter postcode ' id = 'location '>
13
- < button id ="submit_button "> Get stats</ button >
10
+ < form action ="{{ url_for('viewcrime') }} " method ='POST '>
11
+ < input type = 'text ' name ='location ' placeholder ='Enter a UK address ' id = 'location '>
12
+ < button type ="submit " id ="submit_button " class ="button-styling "> Get stats</ button >
14
13
</ form >
15
14
</ body >
16
15
</ html >
Original file line number Diff line number Diff line change 3
3
< head >
4
4
< meta http-equiv ="Content-type " content ="text/html; charset=utf-8 ">
5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
- < script type ="text/javascript " src ="http ://d3js.org/d3.v3.min .js "> </ script >
7
- < script src ="http ://labratrevenge. com/d3-tip/javascripts /d3. tip.v0.6.3 .js "> </ script >
6
+ < script type ="text/javascript " src ="https ://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3 .js "> </ script >
7
+ < script src ="https ://cdnjs.cloudflare. com/ajax/libs/ d3-tip/0.7.1 /d3- tip.min .js "> </ script >
8
8
< link rel ="stylesheet " href ="/static/style.css ">
9
9
</ head >
10
10
< body class ="body ">
11
- < div class ="display ">
11
+ < div id ="header ">
12
+ < h2 > You are looking at crime stats for: < h2 >
13
+ < p class ="blink_text "> {{location}}< p >
14
+ < div >
15
+ < div class ="display-flex ">
12
16
< div id ="pie-chart "> </ div >
13
17
< div id ="bar-chart "> </ div >
14
- </ div >
18
+ </ div >
15
19
< form action ="/ ">
16
- < input type ="submit " value ="Home page ">
20
+ < button type ="submit " value ="Home page " class =" button-styling " > Home page </ button >
17
21
</ form >
18
22
< script type ="text/javascript " src ="/static/results.js "> </ script >
19
23
< script type ="text/javascript ">
Original file line number Diff line number Diff line change @@ -34,19 +34,21 @@ def healthz():
34
34
def hello ():
35
35
return render_template ('home.html' )
36
36
37
+
37
38
@app .route ("/home" )
38
39
def home ():
39
40
return redirect ("/" )
41
+
42
+
40
43
def get_data (location ):
41
- # location = 'London'
42
44
KEY = read_json ('params.json' , 'MAPQ' )
43
45
url1 = 'http://open.mapquestapi.com/geocoding/v1/address?'
44
- params1 = dict (
46
+ params1 = dict (
45
47
key = KEY ,
46
48
location = location
47
49
)
48
50
resp1 = requests .get (url = url1 , params = params1 )
49
- ll = json .loads (resp1 .text )['results' ][0 ]['locations' ][0 ]['displayLatLng' ]
51
+ ll = json .loads (resp1 .text )['results' ][0 ]['locations' ][0 ]['displayLatLng' ]
50
52
latitude = ll ['lat' ]
51
53
longitude = ll ['lng' ]
52
54
url = 'https://data.police.uk/api/crimes-street/all-crime?'
You can’t perform that action at this time.
0 commit comments