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
c3ab18e5
Commit
c3ab18e5
authored
Nov 18, 2020
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
Fixed #35 - handle negative temperatures
parent
4a195f58
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/logic/tile/tiles/SensorLineChartTile.html
+24
-14
24 additions, 14 deletions
src/logic/tile/tiles/SensorLineChartTile.html
src/logic/tile/tiles/SensorLineChartTile.py
+15
-2
15 additions, 2 deletions
src/logic/tile/tiles/SensorLineChartTile.py
with
39 additions
and
16 deletions
src/logic/tile/tiles/SensorLineChartTile.html
+
24
−
14
View file @
c3ab18e5
...
@@ -62,7 +62,8 @@
...
@@ -62,7 +62,8 @@
<script>
<script>
function
createChart_
{{
chartId
|
replace
(
'
-
'
,
'
_
'
)
}}()
function
createChart_
{{
chartId
|
replace
(
'
-
'
,
'
_
'
)
}}()
{
{
let
data
=
[{
let
data
=
[
{
x
:
{{
x
}},
x
:
{{
x
}},
y
:
{{
y
}},
y
:
{{
y
}},
text
:
{{
textLabels
}},
text
:
{{
textLabels
}},
...
@@ -76,7 +77,16 @@
...
@@ -76,7 +77,16 @@
},
},
hoverinfo
:
'
text
'
,
hoverinfo
:
'
text
'
,
fillcolor
:
'
{{ fillColor }}
'
fillcolor
:
'
{{ fillColor }}
'
}];
},
{
x
:
{{
ghostTraceX
}},
y
:
{{
ghostTraceY
}},
fill
:
'
tozeroy
'
,
type
:
'
scatter
'
,
mode
:
'
none
'
,
fillcolor
:
'
{{ fillColor }}
'
}
];
let
layout
=
{
let
layout
=
{
xaxis
:
{
xaxis
:
{
...
...
This diff is collapsed.
Click to expand it.
src/logic/tile/tiles/SensorLineChartTile.py
+
15
−
2
View file @
c3ab18e5
...
@@ -75,13 +75,24 @@ class SensorLineChartTile(Tile):
...
@@ -75,13 +75,24 @@ class SensorLineChartTile(Tile):
endDateTime
,
endDateTime
,
storageLeafService
)
storageLeafService
)
# 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.
ghostTraceX
=
[]
ghostTraceY
=
[]
if
all
(
float
(
i
)
>=
0
for
i
in
y
):
if
minValue
<
0
:
ghostTraceX
=
[
x
[
0
],
x
[
-
1
]]
ghostTraceY
=
[
minValue
,
minValue
]
return
{
return
{
'
latest
'
:
latest
,
'
latest
'
:
latest
,
'
x
'
:
x
,
'
x
'
:
x
,
'
y
'
:
y
,
'
y
'
:
y
,
'
sensorInfo
'
:
sensorData
[
'
sensorInfo
'
],
'
sensorInfo
'
:
sensorData
[
'
sensorInfo
'
],
'
min
'
:
minValue
,
'
min
'
:
minValue
,
'
max
'
:
maxValue
'
max
'
:
maxValue
,
'
ghostTraceX
'
:
ghostTraceX
,
'
ghostTraceY
'
:
ghostTraceY
}
}
def
__get_min_and_max
(
self
,
pageName
:
str
,
sensorType
:
Dict
,
def
__get_min_and_max
(
self
,
pageName
:
str
,
sensorType
:
Dict
,
...
@@ -138,7 +149,9 @@ class SensorLineChartTile(Tile):
...
@@ -138,7 +149,9 @@ class SensorLineChartTile(Tile):
title
=
self
.
_settings
[
'
title
'
],
title
=
self
.
_settings
[
'
title
'
],
lineColor
=
self
.
_settings
[
'
lineColor
'
],
lineColor
=
self
.
_settings
[
'
lineColor
'
],
fillColor
=
self
.
_settings
[
'
fillColor
'
],
fillColor
=
self
.
_settings
[
'
fillColor
'
],
chartId
=
str
(
uuid
.
uuid4
()))
chartId
=
str
(
uuid
.
uuid4
()),
ghostTraceX
=
data
[
'
ghostTraceX
'
],
ghostTraceY
=
data
[
'
ghostTraceY
'
])
def
__format_date
(
self
,
dateTime
:
str
):
def
__format_date
(
self
,
dateTime
:
str
):
parsedDateTime
=
datetime
.
strptime
(
dateTime
,
self
.
DATE_FORMAT
)
parsedDateTime
=
datetime
.
strptime
(
dateTime
,
self
.
DATE_FORMAT
)
...
...
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