Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NanoPatch-UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wortman, Elliot (UG - Comp Sci & Elec Eng)
NanoPatch-UI
Commits
215b72fb
Commit
215b72fb
authored
1 year ago
by
Wortman, Elliot (UG - Comp Sci & Elec Eng)
Browse files
Options
Downloads
Patches
Plain Diff
Graph data from `/past-values` endpoint
parent
873731fa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!5
Replace Vue3 template site with NanoPatch UI & API
,
!4
Modify passing x-axis-data as refering to function was causing errors in production build
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app.py
+14
-0
14 additions, 0 deletions
app.py
src/App.vue
+16
-12
16 additions, 12 deletions
src/App.vue
with
30 additions
and
12 deletions
app.py
+
14
−
0
View file @
215b72fb
...
@@ -15,6 +15,20 @@ def values():
...
@@ -15,6 +15,20 @@ def values():
values
=
[{
"
N
"
:
10
},
{
"
P
"
:
11
},
{
"
K
"
:
12
},
{
"
T
"
:
5
},
{
"
H
"
:
6
},
{
"
M
"
:
7
}]
values
=
[{
"
N
"
:
10
},
{
"
P
"
:
11
},
{
"
K
"
:
12
},
{
"
T
"
:
5
},
{
"
H
"
:
6
},
{
"
M
"
:
7
}]
return
jsonify
(
values
)
return
jsonify
(
values
)
@app.route
(
"
/past-values
"
)
def
pastValues
():
past_values
=
{
"
npkData
"
:
{
"
nitrogen
"
:
[
10
,
22
,
15
,
18
,
25
,
30
,
35
],
"
phosphorus
"
:
[
5
,
8
,
10
,
12
,
20
,
22
,
25
],
"
potassium
"
:
[
8
,
12
,
13
,
17
,
23
,
28
,
33
]
},
"
thmData
"
:
{
"
temperature
"
:
[
4
,
15
,
16
,
18
,
20
,
10
,
12
],
"
humidity
"
:
[
25
,
12
,
2
,
22
,
19
,
16
,
25
],
"
moisture
"
:
[
8
,
12
,
13
,
33
,
23
,
28
,
10
]
}}
return
jsonify
(
past_values
)
@app.route
(
'
/favicon.ico
'
)
@app.route
(
'
/favicon.ico
'
)
def
favicon
():
def
favicon
():
...
...
This diff is collapsed.
Click to expand it.
src/App.vue
+
16
−
12
View file @
215b72fb
...
@@ -3,6 +3,7 @@ import ValueTabs from "./components/ValueTabs.vue";
...
@@ -3,6 +3,7 @@ import ValueTabs from "./components/ValueTabs.vue";
</
script
>
</
script
>
<
script
>
<
script
>
import
axios
from
"
axios
"
import
MultiLineChart
from
'
./components/MultiLineChart.vue
'
;
import
MultiLineChart
from
'
./components/MultiLineChart.vue
'
;
import
MultiAxisChart
from
'
./components/MultiAxisChart.vue
'
;
import
MultiAxisChart
from
'
./components/MultiAxisChart.vue
'
;
...
@@ -11,7 +12,18 @@ export default {
...
@@ -11,7 +12,18 @@ export default {
MultiLineChart
,
MultiLineChart
,
MultiAxisChart
MultiAxisChart
},
},
mounted
()
{
this
.
getPastValues
();
},
methods
:
{
methods
:
{
getPastValues
()
{
axios
.
get
(
'
http://127.0.0.1:5000/past-values
'
)
.
then
((
response
)
=>
{
this
.
npkData
=
response
.
data
.
npkData
this
.
thmData
=
response
.
data
.
thmData
})
},
getPastSevenDays
()
{
getPastSevenDays
()
{
const
dates
=
[];
const
dates
=
[];
for
(
let
i
=
6
;
i
>=
0
;
i
--
)
{
for
(
let
i
=
6
;
i
>=
0
;
i
--
)
{
...
@@ -25,16 +37,8 @@ export default {
...
@@ -25,16 +37,8 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
npkData
:
{
npkData
:
null
,
nitrogen
:
[
10
,
22
,
15
,
18
,
25
,
30
,
35
],
thmData
:
null
phosphorus
:
[
5
,
8
,
10
,
12
,
20
,
22
,
25
],
potassium
:
[
8
,
12
,
13
,
17
,
23
,
28
,
33
]
},
thmData
:
{
temperature
:
[
4
,
15
,
16
,
18
,
20
,
10
,
12
],
humidity
:
[
25
,
12
,
2
,
22
,
19
,
16
,
25
],
moisture
:
[
8
,
12
,
13
,
33
,
23
,
28
,
10
]
}
}
}
}
}
}
}
...
@@ -51,8 +55,8 @@ export default {
...
@@ -51,8 +55,8 @@ export default {
</div>
</div>
</div>
</div>
<div
class=
"bottom-section"
>
<div
class=
"bottom-section"
>
<MultiLineChart
:chart-data=
"npkData"
:x-axis-data=
this.getPastSevenDays()
/>
<MultiLineChart
v-if=
"npkData"
:chart-data=
"npkData"
:x-axis-data=
this.getPastSevenDays()
/>
<MultiAxisChart
:chart-data=
"thmData"
:x-axis-data=
this.getPastSevenDays()
/>
<MultiAxisChart
v-if=
"thmData"
:chart-data=
"thmData"
:x-axis-data=
this.getPastSevenDays()
/>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
...
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