X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/5e74f5faa53937f4501651c842f4b900acb4d1c5..12c6d3ce8fac155d829ced736629b5e8399a40e3:/web/static/seepark_web.js diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 504520f..93f5d49 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -1,36 +1,71 @@ var chart = c3.generate({ bindto: '#chart', + transition: { + duration: null + }, title: { - text: 'Seepark' + text: 'Der See' }, data: { url: '/data', mimeType: 'json', xs: { - 'water_temperature': 'water_temperature_x', - 'air_temperature': 'air_temperature_x' + '0316a2193bff': '0316a2193bff_x', + '0316a21383ff': '0316a21383ff_x' }, names: { - 'water_temperature': 'Wassertemperatur', - 'air_temperature': 'Lufttemperatur' - } + '0316a2193bff': 'Wassertemperatur in 4 m Tiefe', + '0316a21383ff': 'Wassertemperatur in 5 m Tiefe' + }, + xFormat: '%Y-%m-%d %H:%M:%S' }, axis: { x: { type: 'timeseries', tick: { - format: '%Y-%m-%d' + format: '%Y-%m-%d %H:%M', + fit: false, + multiline: true, // broken? so → + rotate: -90 } }, y: { label: { - text: '°C', + text: 'Temperatur in °C', position: 'outer-middle' + }, + tick: { + format: function (d) { + return d + '°'; + } } } }, zoom: { enabled: true - } + }, + tooltip: { + format: { + name: function (name, ratio, id, index) { + var re = /\d m/; + var res = re.exec(name); + return res; + }, + value: function (value, ratio, id, index) { + return value + '°'; + } + } + }, + grid: { + y: { + show: true + } + }, + regions: [ + {axis: 'y', start: -999, end: 0, class: 'region-frozen'}, + {axis: 'y', start: 1, end: 25, class: 'region-ok'}, + {axis: 'y', start: 26, end: 99, class: 'region-warm'}, + {axis: 'y', start: 99, end: 999, class: 'region-boiling'} + ] });