// Show the live data chart import {logit, logerror} from './logit.js' import * as utils from './chart_utilities.js' import {DateTime} from "./luxon.min.js"; // ****************************************************************** // PlotDayLive_Noise // ****************************************************************** export const showLive = async (params) => { const url = `/chart/getsensordata?&sensorid=${params.sid}` let ret = await fetch(url) .catch(e => { logerror(e) }); let erg = await ret.json() let chr = Highcharts.chart('dlive', erg.options, function (chart) { utils.addSensorID2chart(chart, {sid: erg.params.sensorid, indoor: erg.params.indoor}, document.getElementById('dlive').offsetWidth) }) } /* let butOpts = [ {fill: 'lightblue', r: 2}, {fill: 'blue', r: 2, style: {color: 'white'}}, {fill: 'lightblue', r: 2}, {fill: 'lightblue', r: 2} ] function renderPfeil(n, chart, x, y, txt, time) { chart.renderer.button(txt, x, y, null, butOpts[0], butOpts[1], butOpts[2], butOpts[3]) .attr({ id: 'button' + n, zIndex: 3, width: 30, }) .on('click', function () { prevHour(time) }) .add() } function prevHour(hours) { console.log("Zurück um ", hours, "Stunden") let start if (startDay == "") { start = moment() start.subtract(24, 'h') } else { start = moment(startDay) } let mrk = moment() mrk.subtract(24, 'h') let startDay = "" if (hours < 0) { start.subtract(Math.abs(hours), 'h') startDay = start.format("YYYY-MM-DDTHH:mm:ssZ") } else if (hours > 0) { start.add(hours, 'h') if (!start.isAfter(mrk)) { startDay = start.format("YYYY-MM-DDTHH:mm:ssZ") } } doPlot('live', startDay) } */