Skip to content
Snippets Groups Projects
Commit 9b640281 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

#36 - prevent fetching min/max from StorageLeaf as this would consume a lot of...

#36 - prevent fetching min/max from StorageLeaf as this would consume a lot of time due to huge timespans
parent 14949c85
No related branches found
No related tags found
No related merge requests found
...@@ -74,7 +74,8 @@ class SensorLineChartTile(Tile): ...@@ -74,7 +74,8 @@ class SensorLineChartTile(Tile):
sensorData['sensorInfo']['type'], sensorData['sensorInfo']['type'],
startDateTime, startDateTime,
endDateTime, endDateTime,
storageLeafService) storageLeafService,
y)
# Check if all values are above zero and the min value for the sensor group is below zero. # Check if all values are above zero and the min value for the sensor group is below zero.
# Therefore a ghost trace must be generated that fills the area underneath the x-axis. # Therefore a ghost trace must be generated that fills the area underneath the x-axis.
...@@ -98,10 +99,18 @@ class SensorLineChartTile(Tile): ...@@ -98,10 +99,18 @@ class SensorLineChartTile(Tile):
def __get_min_and_max(self, pageName: str, sensorType: Dict, def __get_min_and_max(self, pageName: str, sensorType: Dict,
startDateTime: str, endDateTime: str, startDateTime: str, endDateTime: str,
storageLeafService: MultiCacheKeyService): storageLeafService: MultiCacheKeyService, y: List):
if sensorType == SensorType.HUMIDITY: if sensorType == SensorType.HUMIDITY:
return 0, 100 return 0, 100
# prevent fetching min/max from StorageLeaf as this would consume a lot of time due to huge timespans
if self._settings['showAxes']:
yValues = [float(item) for item in y]
if yValues:
return min(0.0, min(yValues)), max(yValues) + self.MAX_Y_AXIS_SPACING
else:
return 0, 0 + self.MAX_Y_AXIS_SPACING
minMaxSettings = { minMaxSettings = {
'url': self._settings['url'], 'url': self._settings['url'],
'sensorIDsForMinMax': self._settings['sensorIDsForMinMax'], 'sensorIDsForMinMax': self._settings['sensorIDsForMinMax'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment