Custom duration for minigraphs

This commit is contained in:
Alexandre
2024-11-26 10:06:12 +01:00
committed by Nachtzuster
parent f93b448b7f
commit 4680b7258e
+3 -3
View File
@@ -610,11 +610,11 @@ startAutoRefresh();
}
</style>
<script>
function generateMiniGraph(elem, comname) {
function generateMiniGraph(elem, comname, days = 30) {
// Make an AJAX call to fetch the number of detections for the bird species
var xhr = new XMLHttpRequest();
xhr.open('GET', '/todays_detections.php?comname=' + comname);
xhr.open('GET', '/todays_detections.php?comname=' + comname + '&days=' + days);
xhr.onload = function() {
if (xhr.status === 200) {
var detections = JSON.parse(xhr.responseText);
@@ -667,7 +667,7 @@ function generateMiniGraph(elem, comname) {
},
title: {
display: true,
text: 'Detections Over 30d'
text: 'Detections Over ' + days + 'd'
},
legend: {
display: false