willplant03 commited on
Commit
ee45088
·
verified ·
1 Parent(s): dc90a3f

make it so I can turn on and off search volume and demand

Browse files
Files changed (2) hide show
  1. index.html +31 -11
  2. style.css +5 -1
index.html CHANGED
@@ -21,16 +21,16 @@
21
  <canvas id="dataChart"></canvas>
22
  </div>
23
  <div class="mt-6 flex justify-center space-x-4">
24
- <div class="flex items-center">
25
- <div class="w-4 h-4 bg-[#3722D3] rounded-full mr-2"></div>
26
- <span class="text-gray-700">Search Volume</span>
27
- </div>
28
- <div class="flex items-center">
29
- <div class="w-4 h-4 bg-[#00FF84] rounded-full mr-2"></div>
30
- <span class="text-gray-700">Demand</span>
31
- </div>
32
  </div>
33
- </div>
34
 
35
  <script>
36
  document.addEventListener('DOMContentLoaded', function() {
@@ -139,9 +139,29 @@
139
  }
140
  }
141
  };
 
142
 
143
- new Chart(ctx, config);
144
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  </script>
146
  <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
147
  </body>
 
21
  <canvas id="dataChart"></canvas>
22
  </div>
23
  <div class="mt-6 flex justify-center space-x-4">
24
+ <button id="toggleSearch" class="flex items-center px-4 py-2 bg-[#3722D3] text-white rounded-full shadow hover:bg-[#2919a8] transition">
25
+ <div class="w-4 h-4 bg-white rounded-full mr-2"></div>
26
+ <span>Search Volume</span>
27
+ </button>
28
+ <button id="toggleDemand" class="flex items-center px-4 py-2 bg-[#00FF84] text-gray-800 rounded-full shadow hover:bg-[#00cc6a] transition">
29
+ <div class="w-4 h-4 bg-white rounded-full mr-2"></div>
30
+ <span>Demand</span>
31
+ </button>
32
  </div>
33
+ </div>
34
 
35
  <script>
36
  document.addEventListener('DOMContentLoaded', function() {
 
139
  }
140
  }
141
  };
142
+ const chart = new Chart(ctx, config);
143
 
144
+ // Toggle buttons functionality
145
+ document.getElementById('toggleSearch').addEventListener('click', function() {
146
+ const meta = chart.getDatasetMeta(0);
147
+ meta.hidden = !meta.hidden;
148
+ chart.update();
149
+ this.classList.toggle('bg-gray-300');
150
+ this.classList.toggle('bg-[#3722D3]');
151
+ this.classList.toggle('text-white');
152
+ this.classList.toggle('text-gray-800');
153
+ });
154
+
155
+ document.getElementById('toggleDemand').addEventListener('click', function() {
156
+ const meta = chart.getDatasetMeta(1);
157
+ meta.hidden = !meta.hidden;
158
+ chart.update();
159
+ this.classList.toggle('bg-gray-300');
160
+ this.classList.toggle('bg-[#00FF84]');
161
+ this.classList.toggle('text-white');
162
+ this.classList.toggle('text-gray-800');
163
+ });
164
+ });
165
  </script>
166
  <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
167
  </body>
style.css CHANGED
@@ -22,7 +22,11 @@ p {
22
  border: 1px solid lightgray;
23
  border-radius: 16px;
24
  }
25
-
26
  .card p:last-child {
27
  margin-bottom: 0;
28
  }
 
 
 
 
 
 
22
  border: 1px solid lightgray;
23
  border-radius: 16px;
24
  }
 
25
  .card p:last-child {
26
  margin-bottom: 0;
27
  }
28
+
29
+ button {
30
+ cursor: pointer;
31
+ transition: all 0.2s ease;
32
+ }