diff --git a/client/jsFiles/SEAWebClientGraphics.js b/client/jsFiles/SEAWebClientGraphics.js index 5531a6a..12e9431 100644 --- a/client/jsFiles/SEAWebClientGraphics.js +++ b/client/jsFiles/SEAWebClientGraphics.js @@ -292,6 +292,7 @@ let graphs = (function (){ let created = false; let activateUpdateTimeout = undefined; + let updateAutoTimeout = undefined; let container = document.createElement('div'); container.classList.add("graphs-container"); @@ -1258,6 +1259,19 @@ let graphs = (function (){ } } + function onZoomCompleteCallback(){ + if (updateAutoTimeout === undefined){ + updateAutoTimeout = setTimeout(function() { + updateAuto(); + updateAutoTimeout = undefined; + }, 100); + } + else{ + clearTimeout(updateAutoTimeout); + updateAutoTimeout = undefined; + } + } + return { addDataset: addDataset, //toggleAxesType: toggleAxesType, @@ -1291,6 +1305,7 @@ let graphs = (function (){ shiftNewer: shiftNewer, jumpToDate: jumpToDate, initGraphs: initGraphs, + onZoomCompleteCallback:onZoomCompleteCallback, } })(); @@ -1431,7 +1446,7 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){ sensitivity: 1, onZoom: function({chart}) { graphs.zoomCallback(chart.graph);}, //onZoomComplete: function({chart}){graphs.checkReload(chart.graph);redraw()}, - onZoomComplete: function({chart}){graphs.updateAuto();}, + onZoomComplete: function({chart}){graphs.onZoomCompleteCallback()}, } } }); diff --git a/influxdb.py b/influxdb.py index f24ee09..433ece0 100644 --- a/influxdb.py +++ b/influxdb.py @@ -121,6 +121,7 @@ class InfluxDataGetter: variable_name_for_query = variable_name_for_query[:-len(".target")] is_target = True start_time = int(lastvalues[variable_name_for_query][0]) if variable_name_for_query in lastvalues.keys() else None + start_time = start_time if start_time != None and start_time <= end_time else None # to prevent self.lastvalues being changed by w_graph between entrance of graphpoll and poll_last_values points = self._get_last_values(variable_name_for_query, is_target,start_time, end_time) if len(points) > 0 : res[variable] = points