-
Notifications
You must be signed in to change notification settings - Fork 1
/
result.html
156 lines (139 loc) · 5.17 KB
/
result.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Title</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
crossorigin="anonymous"
/>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@900&display=swap" rel="stylesheet">
<style>
.hover:hover {
box-shadow: 0 12px 16px 0 rgba(0, 0, 0, 0.24),
0 17px 50px 0 rgba(0, 0, 0, 0.19);
background-color: chartreuse;
color: black;
}
.bgcolor {
background-color: #63718a;
}
</style>
</head>
<body style="background-image: url(back.png); color: white;">
<!-- logo image block -->
<div class="container-fluid px-5">
<div class="row">
<div class="col-6 d-flex flex-row">
<h3 class="p-2 text-white ml-5 mt-3" style="font-size: 35px; font-weight: 900; font-family: 'Montserrat', sans-serif;">Type it</h3>
</div>
<div class="col-6 p-1">
<button id="home" type="button" class="btn p-2 mr-5 mt-4 rounded-pill pl-4 pr-4 float-right shadow-lg hover btn-primary">Home</button>
</div>
</div>
</div>
<!-- chart show block -->
<div class="row mt-5">
<div class="col text-center ml-4">
<!-- <h3 class="mb-3">Performance</h3> -->
<div style="margin-top: 100px;font-family: 'Montserrat', sans-serif;" >
<h3 style="font-family: 'Montserrat', sans-serif;">Your typing speed is:</h3>
</div>
<div>
<h1 class="mt-4" style =" color: red; font-family: 'Montserrat', sans-serif;" id="wpm"></h1>
</div>
</div>
<div class="col text-center">
<h3 id="accuracy" style="font-family: 'Montserrat', sans-serif;" class="mb-3">Accuracy</h3>
<canvas id="chart" height="140px"> </canvas>
</div>
</div>
<h3 class="mt-5" style="text-align: center;font-family: 'Montserrat', sans-serif;">Typing speed Analysis</h3>
<div style="width: 700px; height: 700px;" class="row mx-auto">
<canvas id="barchart"></canvas>
</div>
<!-- JAVA SCRIPT BLOCK -->
<script type="text/javascript">
var ctx, chart;
let query = new URLSearchParams(window.location.search)
let accuracy = query.get('accuracy')
window.addEventListener("load", function () {
let query = window.location.search;
if (query !== "") {
loadUrlDetail(query);
}
console.log(accuracy)
ctx2=document.getElementById("barchart")
chart = new Chart(ctx2, option2)
ctx = document.getElementById("chart");
var myPieChart = new Chart(ctx, {
type: "doughnut",
data: {
datasets: [
{
data: [accuracy, 100-accuracy],
backgroundColor: ["#1f5ff2", "red"],
borderWidth: 0,
},
],
labels: ["correct", "wrong"],
},
options: Chart.defaults.doughnut
});
});
function loadUrlDetail(query) {
let url = new URLSearchParams(query)
let accuracy = url.get("accuracy")
let accu = document.getElementById('accuracy')
accu.textContent = `Accuracy : ${accuracy}%`
let wpm = url.get("wpm")
// console.log(wpm.substr(6,9))
let word = document.getElementById('wpm')
word.textContent = wpm.substr(6,9) + " words per Minute"
}
let bar_data = JSON.parse(localStorage.getItem("wpm_data"))
console.log(bar_data)
let ctx2;
const option2= {
type: "bar",
data: {
labels: bar_data.time,
datasets: [
{
label: "Words Per Min",
data: bar_data.wpm,
// backgroundColor: "rgb(200,50,100)",
backgroundColor: "#0275d8",
},
],
},
options: {
scales: {
yAxes: [
{
ticks: {
beginAtZero: true
}
}
]
}
}
}
</script>
<script type="text/javascript">
let home = document.getElementById("home")
home.addEventListener("click",function(){
window.location.href = "index.html"
})
</script>
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script>
</body>
</html>