Refactored time filter.
This commit is contained in:
parent
4c908f4891
commit
9700bc9d3c
16 changed files with 252 additions and 296 deletions
|
|
@ -1,13 +1,7 @@
|
|||
function preset(hours) {
|
||||
const inputPreset = document.querySelector('input[name="preset"]')
|
||||
inputPreset.value = hours
|
||||
inputPreset.form.submit()
|
||||
}
|
||||
|
||||
function offsetTime(seconds) {
|
||||
const inputPreset = document.querySelector('input[name="offset-time"]')
|
||||
inputPreset.value = seconds
|
||||
inputPreset.form.submit()
|
||||
function selectDisplay(display) {
|
||||
const inputDisplay = document.getElementById('input-display')
|
||||
inputDisplay.value = display
|
||||
inputDisplay.form.submit()
|
||||
}
|
||||
|
||||
class Graph {
|
||||
|
|
@ -61,7 +55,9 @@ class Dataset {
|
|||
constructor(id, initialData) {
|
||||
this.datapointID = id
|
||||
this.values = {}
|
||||
initialData.forEach(v=>this.values[v.ID] = v)
|
||||
if (initialData === null)
|
||||
return
|
||||
initialData.forEach(v => this.values[v.ID] = v)
|
||||
}
|
||||
|
||||
xValues() {
|
||||
|
|
@ -76,7 +72,7 @@ class Dataset {
|
|||
return fetch(`/datapoint/json/${this.datapointID}?f=${from}&t=${to}`)
|
||||
.then(data => data.json())
|
||||
.then(datapointValues => {
|
||||
datapointValues.forEach(dp=>{
|
||||
datapointValues.forEach(dp => {
|
||||
this.values[dp.ID] = dp
|
||||
})
|
||||
document.getElementById('num-values').innerText = Object.keys(this.values).length
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue