-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
113 lines (112 loc) · 3.75 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/7.9.0/d3.min.js"></script>
<style>
body {
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
overflow: hidden;
background-color: #f5f5f5; /* Optional: Improve background aesthetics */
font-family: Inter, Helvetica, Arial, sans-serif;
}
/* Container for the switch */
.switch-container {
margin: 20px 0 20px 0; /* Reduced bottom margin to minimize space between switch and chart */
display: flex;
align-items: center;
font-size: 16px;
}
/* Switch styling */
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
margin: 0 15px; /* Reduced horizontal margin to decrease space between switch and labels */
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: 0.4s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
transition: 0.4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #66bb6a;
}
input:focus + .slider {
box-shadow: 0 0 1px #66bb6a;
}
input:checked + .slider:before {
transform: translateX(26px);
}
#chart {
width: 90vw;
max-width: 1200px;
height: auto;
}
svg {
width: 100%;
height: auto; /* Ensure aspect ratio is maintained */
}
text {
font-size: 16px; /* Adjusted for better readability */
}
/* Tooltip styling */
.tooltip {
position: absolute;
background-color: rgba(255, 255, 255, 0.95);
border: 1px solid #aaa;
padding: 10px;
font-size: 13px;
pointer-events: none; /* Prevent tooltip from interfering with mouse events */
opacity: 0; /* Initially hidden */
transition: opacity 0.2s ease;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
border-radius: 5px;
font-family: Inter, Helvetica, Arial, sans-serif;
}
</style>
</head>
<body>
<!-- Switch Container -->
<div class="switch-container">
<span>Mainnet</span>
<label class="switch">
<input type="checkbox" id="viewSwitch">
<span class="slider"></span>
</label>
<span>Testnet</span>
</div>
<!-- Chart and Tooltip -->
<div id="chart"></div>
<div id="tooltip" class="tooltip"></div> <!-- Tooltip div -->
<script src="chart.js"></script>
</body>
</html>