diff --git a/app/aggregate.html b/app/aggregate.html
index 936d046..125b811 100644
--- a/app/aggregate.html
+++ b/app/aggregate.html
@@ -1,9 +1,15 @@
- openSenseMap Dataview
+ openSenseMap data aggregation
@@ -26,6 +32,22 @@
Tag
Stunde
+
+
+ Advanced Usage
+
+ Shown data can be modified through the URL search query. Supported keys are:
+ boxId, phenomenon, start, end, windowSize, operation
+ For supported values check out the openSenseMap API docs .
+
+
+ Example:
+
+ ?boxId=5b26181b1fef04001b69093c&phenomenon=Temperatur&operation=max&windowSize=14 days&start=2019-10-01T00:00:00.000Z
+
+
+
+
@@ -43,10 +65,9 @@
windowSize: '30 days',
}
- const config = Object.assign(defaultConfig, parseHash())
+ const config = Object.assign(defaultConfig, parseQuery())
main(config).catch(console.error)
-
async function main (config) {
try {
const data = await fetchOsemDataAggregate(config)
@@ -64,12 +85,10 @@
}
}
- function parseHash () {
+ function parseQuery () {
const kvPairs = window.location.search
- // remove leading ?
- .slice(1)
- // create objects from kvpairs
- .split('&')
+ .slice(1) // remove leading ?
+ .split('&') // create list of { key: value } objects
.map(kv => {
[k,v] = kv.split('=')
return { [k]: decodeURIComponent(v) }
@@ -134,9 +153,10 @@
addRow(config.operation, `${valFormat(aggregate)} ${data['unit']}`)
}
+ // click handler of the UI buttons.
function loadConfig (queryString, reset = true) {
if (reset)
- window.location.search = queryString
+ window.location.search = queryString // this assignment reloads the page
else
window.location.search += queryString
}