Download script.js from OppaiKami/dataviz-telecom-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 2.1 kB
-
https://huggingface.co/spaces/OppaiKami/dataviz-telecom-dashboard/resolve/main/script.js
- Command line
-
hf download hf://spaces/OppaiKami/dataviz-telecom-dashboard/script.js
-
curl -L -o script.js https://huggingface.co/spaces/OppaiKami/dataviz-telecom-dashboard/resolve/main/script.js
2.1 kB
| // Sample data for the telecom providers | |
| const telecomData = { | |
| mtn: [ | |
| { data: "1GB", cost: 5.00, charge: 0.30, price: 5.30, actual: 6.50, difference: 1.20 }, | |
| { data: "2GB", cost: 10.00, charge: 0.60, price: 10.60, actual: 12.00, difference: 1.40 }, | |
| { data: "3GB", cost: 14.00, charge: 0.84, price: 14.84, actual: 16.00, difference: 1.16 }, | |
| // Add more MTN data here | |
| ], | |
| telecel: [ | |
| { data: "5GB", cost: 21.00, charge: 1.26, price: 22.26, actual: 23.50, difference: 1.24 }, | |
| { data: "10GB", cost: 38.00, charge: 2.28, price: 40.28, actual: 41.50, difference: 1.22 }, | |
| { data: "15GB", cost: 57.00, charge: 3.42, price: 60.42, actual: 61.50, difference: 1.08 }, | |
| // Add more Telecel data here | |
| ], | |
| at: [ | |
| { data: "1GB", cost: 4.50, charge: 0.27, price: 4.77, actual: 6.00, difference: 1.23 }, | |
| { data: "2GB", cost: 9.00, charge: 0.54, price: 9.54, actual: 10.50, difference: 0.96 }, | |
| { data: "3GB", cost: 12.00, charge: 0.72, price: 12.72, actual: 14.00, difference: 1.28 }, | |
| // Add more AT data here | |
| ] | |
| }; | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Network selection functionality | |
| const networkButtons = document.querySelectorAll('.network-btn'); | |
| networkButtons.forEach(button => { | |
| button.addEventListener('click', function() { | |
| networkButtons.forEach(btn => btn.classList.remove('active')); | |
| this.classList.add('active'); | |
| const selectedNetwork = this.dataset.network; | |
| // Update charts and data based on selected network | |
| updateCharts(selectedNetwork); | |
| }); | |
| }); | |
| // Initialize with MTN data | |
| updateCharts('mtn'); | |
| }); | |
| function updateCharts(network) { | |
| // This would update the charts with the selected network's data | |
| console.log(`Updating charts with ${network} data`); | |
| // In a real implementation, you would: | |
| // 1. Get the data for the selected network | |
| // 2. Update the chart visualization | |
| // 3. Highlight the relevant data cards | |
| } |