|
|
@ -32,9 +32,10 @@ async function populateTimeseries(category) { |
|
|
|
response.json().then(response => { |
|
|
|
response.json().then(response => { |
|
|
|
const data = response.map(row => ({ |
|
|
|
const data = response.map(row => ({ |
|
|
|
x: row.sampling_date, |
|
|
|
x: row.sampling_date, |
|
|
|
y: parseInt(row.counts) |
|
|
|
y: parseInt(row.counts), |
|
|
|
|
|
|
|
details: row.details |
|
|
|
})); |
|
|
|
})); |
|
|
|
console.debug(data); |
|
|
|
console.debug(response); |
|
|
|
|
|
|
|
|
|
|
|
const chartOptions = { |
|
|
|
const chartOptions = { |
|
|
|
type: 'bar', |
|
|
|
type: 'bar', |
|
|
@ -65,9 +66,20 @@ async function populateTimeseries(category) { |
|
|
|
length: 4 |
|
|
|
length: 4 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
plugins: { |
|
|
|
|
|
|
|
tooltip: { |
|
|
|
|
|
|
|
callbacks: { |
|
|
|
|
|
|
|
label: function(tooltipItems) { |
|
|
|
|
|
|
|
console.debug('adsfasdfasdf',tooltipItems); |
|
|
|
|
|
|
|
return tooltipItems.raw.details; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} }; |
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const ctx = document.getElementById(category + '-timeseries').getContext('2d'); |
|
|
|
const ctx = document.getElementById(category + '-timeseries').getContext('2d'); |
|
|
|
new Chart(ctx, chartOptions); |
|
|
|
new Chart(ctx, chartOptions); |
|
|
|