Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DashboardLeaf
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ProjectLeaf
DashboardLeaf
Commits
a9e906cc
Commit
a9e906cc
authored
Feb 9, 2021
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
SensorLineChartTile: Refactoring: calculate min/max and add spacing only at once
parent
3afd10cc
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/logic/tile/tiles/SensorLineChartTile.py
+7
-7
7 additions, 7 deletions
src/logic/tile/tiles/SensorLineChartTile.py
with
7 additions
and
7 deletions
src/logic/tile/tiles/SensorLineChartTile.py
+
7
−
7
View file @
a9e906cc
...
...
@@ -112,12 +112,12 @@ class SensorLineChartTile(Tile):
# 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
(
y
Value
s
)),
max
(
yValues
)
+
self
.
MAX_Y_AXIS_SPACING
minValue
=
min
(
yValues
,
default
=
0
)
max
Value
=
max
(
yValues
,
default
=
0
)
else
:
return
0
,
0
+
self
.
MAX_Y_AXIS_SPACING
return
self
.
__get_min_max_from_service
(
pageName
,
startDateTime
,
endDateTime
,
storageLeafService
)
minValue
,
maxValue
=
self
.
__get_min_max_from_service
(
pageName
,
startDateTime
,
endDateTime
,
storageLeafService
)
return
min
(
0
,
minValue
),
maxValue
+
self
.
MAX_Y_AXIS_SPACING
def
__get_min_max_from_service
(
self
,
pageName
:
str
,
startDateTime
:
str
,
endDateTime
:
str
,
storageLeafService
:
MultiCacheKeyService
):
...
...
@@ -132,7 +132,7 @@ class SensorLineChartTile(Tile):
cacheKey
=
f
'
{
pageName
}
_
{
self
.
_uniqueName
}
_minMax
'
minMaxData
=
storageLeafService
.
get_data
(
cacheKey
,
self
.
_intervalInSeconds
,
minMaxSettings
)
LOGGER
.
debug
(
f
'
Received min/max:
{
minMaxData
}
for sensorIDs:
{
self
.
_settings
[
"
sensorIDsForMinMax
"
]
}
'
)
return
min
(
0
,
minMaxData
[
'
min
'
]
or
0
)
,
(
minMaxData
[
'
max
'
]
or
0
)
+
self
.
MAX_Y_AXIS_SPACING
return
minMaxData
.
get
(
'
min
'
,
0
)
or
0
,
minMaxData
.
get
(
'
max
'
,
0
)
or
0
def
__prepare_measurement_data
(
self
,
measurements
:
List
[
Dict
])
->
Tuple
[
List
[
str
],
List
[
str
]]:
x
=
[]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment