mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-10 03:14:58 -04:00
Initial commit - experimentation for now
This commit is contained in:
24
app/assets/javascripts/dataVisualization.js
Normal file
24
app/assets/javascripts/dataVisualization.js
Normal file
@@ -0,0 +1,24 @@
|
||||
(function (window) {
|
||||
|
||||
// Dummy data (replace with API data)
|
||||
const totalMessages = 1000;
|
||||
const delivered = 800;
|
||||
const pending = 100;
|
||||
const failed = 100;
|
||||
|
||||
// Calculate percentages
|
||||
const deliveredPercentage = (delivered / totalMessages) * 100;
|
||||
const pendingPercentage = (pending / totalMessages) * 100;
|
||||
const failedPercentage = (failed / totalMessages) * 100;
|
||||
|
||||
// Set width of bars
|
||||
document.getElementById("delivered").style.width = `${deliveredPercentage}%`;
|
||||
document.getElementById("pending").style.width = `${pendingPercentage}%`;
|
||||
document.getElementById("failed").style.width = `${failedPercentage}%`;
|
||||
|
||||
// Update legend values
|
||||
document.getElementById("delivered-value").innerText = delivered;
|
||||
document.getElementById("pending-value").innerText = pending;
|
||||
document.getElementById("failed-value").innerText = failed;
|
||||
|
||||
})(window);
|
||||
Reference in New Issue
Block a user