Base design
This commit is contained in:
12
watcher_visio/static/js/analytics/utils.js
Normal file
12
watcher_visio/static/js/analytics/utils.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// Utility functions
|
||||
function calculateStats(data) {
|
||||
if (!data || data.length === 0) return { mean: 0, std: 0 };
|
||||
|
||||
const mean = data.reduce((a, b) => a + b, 0) / data.length;
|
||||
const variance = data.reduce((a, b) => a + Math.pow(b - mean, 2), 0) / data.length;
|
||||
const std = Math.sqrt(variance);
|
||||
|
||||
return { mean, std };
|
||||
}
|
||||
|
||||
// Export other utility functions...
|
||||
Reference in New Issue
Block a user