SamKakar commited on
Commit
50d72fc
·
verified ·
1 Parent(s): 1152c17

Well I would really like analytics that are easy to look at. so a chart that allows customer to choose the age range they're looking to hangout with. Also a chart that allows the customer to choose which music genre they prefer.

Browse files
Files changed (1) hide show
  1. index.html +154 -6
index.html CHANGED
@@ -197,9 +197,47 @@
197
  </div>
198
  </div>
199
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
  <!-- Features Section -->
202
- <section class="bg-gradient-to-b from-gray-900 to-black py-24">
203
  <div class="container mx-auto px-4">
204
  <h3 class="text-3xl font-bold text-center mb-16">Why Choose NightPulse Explorer?</h3>
205
  <div class="grid grid-cols-1 md:grid-cols-3 gap-12">
@@ -313,10 +351,121 @@
313
  </div>
314
  </footer>
315
  </div>
316
-
317
  <script>
318
  // Initialize Vanta.js background
319
- VANTA.NET({
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  el: "#vanta-bg",
321
  mouseControls: true,
322
  touchControls: true,
@@ -334,9 +483,8 @@
334
 
335
  // Initialize feather icons
336
  feather.replace();
337
-
338
- // Add animation to cards on scroll
339
- document.addEventListener('DOMContentLoaded', function() {
340
  const venueCards = document.querySelectorAll('.venue-card');
341
 
342
  const observer = new IntersectionObserver((entries) => {
 
197
  </div>
198
  </div>
199
  </section>
200
+ <!-- Analytics Section -->
201
+ <section class="py-24 bg-gray-900">
202
+ <div class="container mx-auto px-4">
203
+ <h3 class="text-3xl font-bold text-center mb-12">Nightlife Analytics</h3>
204
+
205
+ <!-- Age Range Chart -->
206
+ <div class="bg-gray-800 bg-opacity-70 backdrop-blur-sm rounded-xl p-6 mb-12">
207
+ <div class="flex justify-between items-center mb-6">
208
+ <h4 class="text-2xl font-bold">Age Range Distribution</h4>
209
+ <div class="flex space-x-2">
210
+ <button class="bg-gray-700 text-white px-4 py-2 rounded-lg text-sm hover:bg-gray-600 transition" id="age-all">All</button>
211
+ <button class="bg-pink-900 text-white px-4 py-2 rounded-lg text-sm hover:bg-pink-800 transition" id="age-18-25">18-25</button>
212
+ <button class="bg-purple-900 text-white px-4 py-2 rounded-lg text-sm hover:bg-purple-800 transition" id="age-25-35">25-35</button>
213
+ <button class="bg-blue-900 text-white px-4 py-2 rounded-lg text-sm hover:bg-blue-800 transition" id="age-35-45">35-45</button>
214
+ </div>
215
+ </div>
216
+ <div class="h-64 w-full" id="ageChart">
217
+ <!-- Chart will be rendered here -->
218
+ </div>
219
+ </div>
220
+
221
+ <!-- Music Genre Chart -->
222
+ <div class="bg-gray-800 bg-opacity-70 backdrop-blur-sm rounded-xl p-6">
223
+ <div class="flex justify-between items-center mb-6">
224
+ <h4 class="text-2xl font-bold">Music Genre Popularity</h4>
225
+ <div class="flex space-x-2">
226
+ <button class="bg-gray-700 text-white px-4 py-2 rounded-lg text-sm hover:bg-gray-600 transition" id="genre-all">All</button>
227
+ <button class="bg-red-900 text-white px-4 py-2 rounded-lg text-sm hover:bg-red-800 transition" id="genre-edm">EDM</button>
228
+ <button class="bg-yellow-900 text-white px-4 py-2 rounded-lg text-sm hover:bg-yellow-800 transition" id="genre-rock">Rock</button>
229
+ <button class="bg-indigo-900 text-white px-4 py-2 rounded-lg text-sm hover:bg-indigo-800 transition" id="genre-hiphop">Hip Hop</button>
230
+ </div>
231
+ </div>
232
+ <div class="h-64 w-full" id="genreChart">
233
+ <!-- Chart will be rendered here -->
234
+ </div>
235
+ </div>
236
+ </div>
237
+ </section>
238
 
239
  <!-- Features Section -->
240
+ <section class="bg-gradient-to-b from-gray-900 to-black py-24">
241
  <div class="container mx-auto px-4">
242
  <h3 class="text-3xl font-bold text-center mb-16">Why Choose NightPulse Explorer?</h3>
243
  <div class="grid grid-cols-1 md:grid-cols-3 gap-12">
 
351
  </div>
352
  </footer>
353
  </div>
354
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
355
  <script>
356
  // Initialize Vanta.js background
357
+ // Initialize Charts
358
+ document.addEventListener('DOMContentLoaded', function() {
359
+ // Age Range Chart
360
+ const ageCtx = document.getElementById('ageChart').getContext('2d');
361
+ const ageChart = new Chart(ageCtx, {
362
+ type: 'bar',
363
+ data: {
364
+ labels: ['18-25', '25-35', '35-45', '45+'],
365
+ datasets: [{
366
+ label: 'Venues by Age Range',
367
+ data: [42, 38, 15, 5],
368
+ backgroundColor: [
369
+ 'rgba(219, 39, 119, 0.7)',
370
+ 'rgba(168, 85, 247, 0.7)',
371
+ 'rgba(59, 130, 246, 0.7)',
372
+ 'rgba(156, 163, 175, 0.7)'
373
+ ],
374
+ borderColor: [
375
+ 'rgba(219, 39, 119, 1)',
376
+ 'rgba(168, 85, 247, 1)',
377
+ 'rgba(59, 130, 246, 1)',
378
+ 'rgba(156, 163, 175, 1)'
379
+ ],
380
+ borderWidth: 1
381
+ }]
382
+ },
383
+ options: {
384
+ responsive: true,
385
+ scales: {
386
+ y: {
387
+ beginAtZero: true,
388
+ title: {
389
+ display: true,
390
+ text: 'Number of Venues'
391
+ }
392
+ },
393
+ x: {
394
+ title: {
395
+ display: true,
396
+ text: 'Age Range'
397
+ }
398
+ }
399
+ }
400
+ }
401
+ });
402
+
403
+ // Genre Chart
404
+ const genreCtx = document.getElementById('genreChart').getContext('2d');
405
+ const genreChart = new Chart(genreCtx, {
406
+ type: 'doughnut',
407
+ data: {
408
+ labels: ['EDM', 'Hip Hop', 'Rock', 'R&B', 'Jazz', 'Alternative', 'Pop', 'Other'],
409
+ datasets: [{
410
+ label: 'Music Genre Distribution',
411
+ data: [25, 20, 18, 15, 10, 7, 4, 1],
412
+ backgroundColor: [
413
+ 'rgba(219, 39, 119, 0.7)',
414
+ 'rgba(16, 185, 129, 0.7)',
415
+ 'rgba(234, 179, 8, 0.7)',
416
+ 'rgba(239, 68, 68, 0.7)',
417
+ 'rgba(59, 130, 246, 0.7)',
418
+ 'rgba(139, 92, 246, 0.7)',
419
+ 'rgba(20, 184, 166, 0.7)',
420
+ 'rgba(156, 163, 175, 0.7)'
421
+ ],
422
+ borderWidth: 1
423
+ }]
424
+ },
425
+ options: {
426
+ responsive: true,
427
+ plugins: {
428
+ legend: {
429
+ position: 'right',
430
+ },
431
+ title: {
432
+ display: true,
433
+ text: 'Music Genre Popularity'
434
+ }
435
+ }
436
+ }
437
+ });
438
+
439
+ // Filter buttons functionality
440
+ document.querySelectorAll('#age-all, #age-18-25, #age-25-35, #age-35-45').forEach(btn => {
441
+ btn.addEventListener('click', function() {
442
+ const filter = this.id.split('-').pop();
443
+ if (filter === 'all') {
444
+ ageChart.data.datasets[0].data = [42, 38, 15, 5];
445
+ } else {
446
+ ageChart.data.datasets[0].data = [0, 0, 0, 0];
447
+ const index = ['18-25', '25-35', '35-45', '45+'].indexOf(filter.replace(/(\d+)-(\d+)/, '$1-$2'));
448
+ if (index !== -1) ageChart.data.datasets[0].data[index] = [42, 38, 15, 5][index];
449
+ }
450
+ ageChart.update();
451
+ });
452
+ });
453
+
454
+ document.querySelectorAll('#genre-all, #genre-edm, #genre-rock, #genre-hiphop').forEach(btn => {
455
+ btn.addEventListener('click', function() {
456
+ const filter = this.id.split('-').pop();
457
+ if (filter === 'all') {
458
+ genreChart.data.datasets[0].data = [25, 20, 18, 15, 10, 7, 4, 1];
459
+ } else {
460
+ genreChart.data.datasets[0].data = [0, 0, 0, 0, 0, 0, 0, 0];
461
+ const index = ['edm', 'hiphop', 'rock', 'r&b', 'jazz', 'alternative', 'pop', 'other'].indexOf(filter);
462
+ if (index !== -1) genreChart.data.datasets[0].data[index] = [25, 20, 18, 15, 10, 7, 4, 1][index];
463
+ }
464
+ genreChart.update();
465
+ });
466
+ });
467
+ });
468
+ VANTA.NET({
469
  el: "#vanta-bg",
470
  mouseControls: true,
471
  touchControls: true,
 
483
 
484
  // Initialize feather icons
485
  feather.replace();
486
+ // Add animation to cards on scroll and initialize charts
487
+ document.addEventListener('DOMContentLoaded', function() {
 
488
  const venueCards = document.querySelectorAll('.venue-card');
489
 
490
  const observer = new IntersectionObserver((entries) => {