forked from winsoft-technologies/2020-interns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment.html
More file actions
180 lines (154 loc) · 3.08 KB
/
assignment.html
File metadata and controls
180 lines (154 loc) · 3.08 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html>
<html>
<head>
<title>Winsoft Graph</title>
</head>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
canvas
{
border: 1px solid black;
margin-top: 50px;
margin-left: 100px;
}
</style>
<body>
<canvas>
</canvas>
</body>
<script type="text/javascript">
var canvas=document.querySelector('canvas');
canvas.width=1000;
canvas.height=600;
var xgrid=10;
var ygrid=10;
var cellsize=10;
var ctx=canvas.getContext('2d');
var data={
Jan0219:79.9855,
Jan0319:79.608,
Jan0419:79.4315,
Jan0719:79.6895,
Jan0819:80.245,
Jan0919:80.6365,
Jan1019:81.2005,
Jan1119:81.3475,
Jan1419:81.2195,
Jan1519:81.213,
Jan1619:81.0055,
Jan1719:80.9765,
Jan1819:81.0875,
Jan2119:80.9335,
Jan2219:81.046,
Jan2319:81.0535,
Jan2419:80.656,
Jan2519:80.634,
Jan2819:81.232,
Jan2919:81.306,
Jan3019:81.351,
Jan3119:81.686
}
var data1={
Jan0219:0.90165,
Jan0319:0.90312,
Jan0419:0.89988,
Jan0719:0.8972,
Jan0819:0.89743,
Jan0919:0.89913,
Jan1019:0.90423,
Jan1119:0.90015,
Jan1419:0.89263,
Jan1519:0.89025,
Jan1619:0.8859,
Jan1719:0.8826,
Jan1819:0.88125,
Jan2119:0.88303,
Jan2219:0.88,
Jan2319:0.87213,
Jan2419:0.87085,
Jan2519:0.8658,
Jan2819:0.86888,
Jan2919:0.86735,
Jan3019:0.87341,
Jan3119:0.87578
}
const entries= Object.entries(data);
const entry= Object.entries(data1);
function drawGrids()
{
ctx.beginPath();
while(xgrid<canvas.height)
{
ctx.moveTo(0,xgrid)
ctx.lineTo(canvas.width,xgrid);
xgrid+=cellsize;
}
while(ygrid<canvas.width)
{
ctx.moveTo(ygrid,0)
ctx.lineTo(ygrid,canvas.height);
ygrid+=cellsize;
}
ctx.strokeStyle='gray';
ctx.stroke();
}
function block(count)
{
return count*10;
}
function Axes()
{
var yplot=50;
var rate=0;
ctx.beginPath();
ctx.strokeStyle="black";
ctx.moveTo(block(5),block(5));
ctx.lineTo(block(5),block(50));
ctx.strokeText("Units to the base euro",block(2),block(22));
ctx.lineTo(block(80),block(50));
ctx.strokeText("To the base euro(date wise)",block(40),block(52));
ctx.moveTo(block(5),block(50));
for (var i = 0; i < 10; i++) {
ctx.strokeText(rate,block(2),block(yplot));
yplot-=5
rate+=10;
}
ctx.stroke();
}
function drawChart()
{
ctx.beginPath();
ctx.strokeStyle='black';
ctx.moveTo(block(5),block(50));
var xPlot=10;
for (const [date,rate] of entries) {
var rateinblock=rate/2;
ctx.lineTo(block(xPlot),block(50-rateinblock));
xPlot+=3;
}
ctx.stroke();
ctx.strokeText("INR",block(xPlot),block(50-rateinblock-3));
}
function drawChart1()
{
ctx.beginPath();
ctx.strokeStyle='black';
ctx.moveTo(block(5),block(50));
var xPlot=10;
for (const [date1,rate] of entry) {
var rateinblock=rate/2;
ctx.lineTo(block(xPlot),block(50-rateinblock));
xPlot+=3;
}
ctx.stroke();
ctx.strokeText("GBP",block(xPlot),block(50-rateinblock-3));
}
drawGrids();
Axes();
drawChart();
drawChart1()
</script>
</html>