Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
eue
Commits
adecec1c
Commit
adecec1c
authored
Aug 04, 2021
by
Spark
Browse files
3743011 default 값 두기
parent
46008734
Changes
8
Hide whitespace changes
Inline
Side-by-side
client/src/App.css
View file @
adecec1c
...
...
@@ -151,7 +151,7 @@ ul li .nav-link:active {
}
#chartTab
{
width
:
100%
;
height
:
7
0vh
;
height
:
6
0vh
;
display
:
flex
;
}
...
...
client/src/Utils/CheckDB.js
View file @
adecec1c
...
...
@@ -2,9 +2,29 @@ import axios from 'axios';
import
{
Swal
}
from
'
sweetalert2
'
;
import
{
routesClient
}
from
'
./../routesClient
'
;
export
function
getTempEtc
()
{
callUserInfo
().
then
((
res
)
=>
{
const
outs
=
axios
.
get
(
routesClient
.
outsideLoc
+
res
[
'
loc_code
'
])
return
outs
.
then
((
res
)
=>
{
const
outWeather
=
res
.
data
.
contents
.
weather_out
console
.
log
(
res
.
data
.
contents
.
weather_out
)
let
i
=
0
;
// setTemp(res.data.contents.weather_out[0].temp)
const
tempArray
=
[]
for
(
i
;
i
<
3
;
i
++
)
{
console
.
log
(
i
)
console
.
log
(
outWeather
[
i
])
tempArray
.
push
(
outWeather
[
i
].
temp
)
}
return
tempArray
// setTemp(tempArray)
})
})
}
export
async
function
callUserInfo
()
{
const
res
=
await
axios
.
get
(
routesClient
.
userinfo
)
console
.
log
(
res
.
data
.
contents
.
user_info
)
return
res
.
data
.
contents
.
user_info
}
...
...
client/src/components/ChartPressure.js
View file @
adecec1c
...
...
@@ -18,7 +18,7 @@ function ChartPressure() {
}
}]
},
//
maintainAspectRatio: false
maintainAspectRatio
:
false
}
const
data
=
{
labels
:
[
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
,
'
5
'
,
'
6
'
,
'
77
'
,
'
88
'
,
'
99
'
],
...
...
@@ -39,22 +39,7 @@ function ChartPressure() {
<
Col
id
=
'
chartTab
'
>
<
Line
data
=
{
data
}
options
=
{{
legend
:
{
display
:
true
,
// label 보이기 여부
},
scales
:
{
yAxes
:
[{
display
:
true
,
ticks
:
{
min
:
900
,
max
:
1100
,
stepSize
:
20
}
}]
},
// maintainAspectRatio: false
}}
options
=
{
options
}
/
>
<
/Col
>
)
...
...
client/src/components/ChartTabs.js
View file @
adecec1c
...
...
@@ -22,6 +22,8 @@ function ChartTabs() {
const
[
key
,
setKey
]
=
useState
(
'
temp
'
);
//3743011 default
return
(
<
Row
className
=
'
text-center w-100 my-2
'
>
<
Card
style
=
{
cardstyled
}
>
...
...
client/src/components/ChartTemp.js
View file @
adecec1c
import
React
from
'
react
'
import
React
,
{
useState
}
from
'
react
'
import
{
Col
}
from
'
react-bootstrap
'
;
import
{
Bar
}
from
'
react-chartjs-2
'
import
{
callUserInfo
}
from
'
../utils/CheckDB
'
;
import
{
useEffect
}
from
'
react
'
;
import
axios
from
'
axios
'
;
import
{
routesClient
}
from
'
./../routesClient
'
;
function
ChartTemp
()
{
const
[
temp
,
setTemp
]
=
useState
([])
useEffect
(()
=>
{
callUserInfo
().
then
((
res
)
=>
{
const
outs
=
axios
.
get
(
routesClient
.
outsideLoc
+
res
[
'
loc_code
'
])
return
outs
.
then
((
res
)
=>
{
const
outWeather
=
res
.
data
.
contents
.
weather_out
console
.
log
(
res
.
data
.
contents
.
weather_out
)
let
i
=
0
;
// setTemp(res.data.contents.weather_out[0].temp)
const
tempArray
=
[]
for
(
i
;
i
<
3
;
i
++
)
{
console
.
log
(
i
)
console
.
log
(
outWeather
[
i
])
tempArray
.
push
(
outWeather
[
i
].
temp
)
}
setTemp
(
tempArray
)
})
})
},
[])
console
.
log
(
temp
)
const
options
=
{
legend
:
{
display
:
true
,
// label 보이기 여부
...
...
@@ -12,7 +40,7 @@ function ChartTemp() {
yAxes
:
[{
ticks
:
{
min
:
0
,
// y축 스케일에 대한 최소값 설정
stepSize
:
1
,
// y축 그리드 한 칸당 수치
stepSize
:
0.5
,
// y축 그리드 한 칸당 수치
}
}]
},
...
...
@@ -27,7 +55,7 @@ function ChartTemp() {
{
label
:
'
온도
'
,
borderWidth
:
'
2
'
,
data
:
[
18
,
22
,
25
,
31
,
28
,
25
,
18
,
6
,
-
8
]
,
data
:
temp
,
borderColor
:
[
'
rgba(75,192,192,1)
'
,
'
rgba(75,192,192,1)
'
,
...
...
@@ -46,7 +74,7 @@ function ChartTemp() {
'
rgba(75,192,192,0.4)
'
,
'
rgba(75,192,192,0.4)
'
,
'
rgba(75,192,192,0.4)
'
,
'
rgba(191,191,191,0.4)
'
,
'
rgba(191,191,191,0.4)
'
,
'
rgba(191,191,191,0.4)
'
]
...
...
@@ -54,14 +82,16 @@ function ChartTemp() {
]
};
return
(
<
Col
id
=
'
chartTab
'
>
<
Bar
data
=
{
data
}
options
=
{
options
}
/
>
<
/Col
>
)
return
(
<
Col
id
=
'
chartTab
'
>
<
Bar
data
=
{
data
}
options
=
{
options
}
/
>
<
/Col
>
)
};
export
default
ChartTemp
;
\ No newline at end of file
client/src/components/MainLayer.js
View file @
adecec1c
...
...
@@ -45,7 +45,6 @@ function MainLayer() {
<
/Row
>
<
Row
className
=
'
m-auto d-flex justify-content-center w-100
'
>
<
TimeNow
/>
<
UserInfo
/>
<
/Row
>
...
...
@@ -77,6 +76,7 @@ function MainLayer() {
}
<
/ButtonGroup
>
<
TimeNow
/>
<
/Row
>
<
Row
className
=
'
m-auto justify-content-center w-100
'
id
=
'
contour
'
>
...
...
client/src/components/UserInfo.js
View file @
adecec1c
...
...
@@ -76,7 +76,7 @@ function UserInfo() {
},
[]);
return
(
<
Col
className
=
"
text-center p
b
-2 px-0
"
>
<
Col
className
=
"
text-center p
t
-2 px-0
"
>
<
Card
style
=
{
cardstyled
}
id
=
"
localName
"
>
<
Card
.
Title
>
<
strong
>
...
...
client/src/routesClient.js
View file @
adecec1c
...
...
@@ -4,9 +4,11 @@ export const routesClient = {
login
:
'
/api/login
'
,
edit
:
'
/api/edit-profile
'
,
localdata
:
'
/api/data/loccode
'
,
outsideLoc
:
'
/api/data/outside?loccode=
'
,
usingAircon
:
'
/api/toggle-aircon
'
,
logout
:
'
/api/logout
'
,
userinfo
:
'
/api/user-info
'
userinfo
:
'
/api/user-info
'
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment