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
94720bc6
Commit
94720bc6
authored
Aug 04, 2021
by
KangMin An
Browse files
Update: DB Sync Setting.
parent
ede947b3
Changes
3
Show whitespace changes
Inline
Side-by-side
client/src/components/ChartTemp.js
View file @
94720bc6
import
React
,
{
useState
}
from
'
react
'
import
React
,
{
useState
}
from
"
react
"
;
import
{
Col
}
from
'
react-bootstrap
'
;
import
{
Col
}
from
"
react-bootstrap
"
;
import
{
Bar
}
from
'
react-chartjs-2
'
import
{
Bar
}
from
"
react-chartjs-2
"
;
import
{
callUserInfo
}
from
'
../utils/CheckDB
'
;
import
{
callUserInfo
}
from
"
../utils/CheckDB
"
;
import
{
useEffect
}
from
'
react
'
;
import
{
useEffect
}
from
"
react
"
;
import
axios
from
'
axios
'
;
import
axios
from
"
axios
"
;
import
{
routesClient
}
from
'
./../routesClient
'
;
import
{
routesClient
}
from
"
./../routesClient
"
;
function
ChartTemp
()
{
function
ChartTemp
()
{
const
[
temp
,
setTemp
]
=
useState
([]);
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)
// })
// })
// }, [])
useEffect
(()
=>
{
console
.
log
(
temp
);
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
=
{
const
options
=
{
legend
:
{
legend
:
{
display
:
true
,
// label 보이기 여부
display
:
true
,
// label 보이기 여부
},
},
scales
:
{
scales
:
{
yAxes
:
[{
yAxes
:
[
{
ticks
:
{
ticks
:
{
min
:
0
,
// y축 스케일에 대한 최소값 설정
min
:
0
,
// y축 스케일에 대한 최소값 설정
stepSize
:
0.5
,
// y축 그리드 한 칸당 수치
stepSize
:
0.5
,
// y축 그리드 한 칸당 수치
}
},
}]
},
],
},
},
// false : 사용자 정의 크기에 따라 그래프 크기가 결정됨.
// false : 사용자 정의 크기에 따라 그래프 크기가 결정됨.
// true : 크기가 알아서 결정됨.
// true : 크기가 알아서 결정됨.
maintainAspectRatio
:
false
maintainAspectRatio
:
false
,
}
}
;
const
data
=
{
const
data
=
{
labels
:
[
'
1
'
,
'
2
'
,
'
3
'
,
'
4
'
,
'
5
'
,
'
6
'
,
'
77
'
,
'
88
'
,
'
99
'
],
labels
:
[
"
1
"
,
"
2
"
,
"
3
"
,
"
4
"
,
"
5
"
,
"
6
"
,
"
77
"
,
"
88
"
,
"
99
"
],
datasets
:
[
datasets
:
[
{
{
label
:
'
온도
'
,
label
:
"
온도
"
,
borderWidth
:
'
2
'
,
borderWidth
:
"
2
"
,
data
:
temp
,
data
:
temp
,
borderColor
:
[
borderColor
:
[
'
rgba(75,192,192,1)
'
,
"
rgba(75,192,192,1)
"
,
'
rgba(75,192,192,1)
'
,
"
rgba(75,192,192,1)
"
,
'
rgba(75,192,192,1)
'
,
"
rgba(75,192,192,1)
"
,
'
rgba(75,192,192,1)
'
,
"
rgba(75,192,192,1)
"
,
'
rgba(75,192,192,1)
'
,
"
rgba(75,192,192,1)
"
,
'
rgba(75,192,192,1)
'
,
"
rgba(75,192,192,1)
"
,
'
rgba(191,191,191,1)
'
,
"
rgba(191,191,191,1)
"
,
'
rgba(191,191,191,1)
'
,
"
rgba(191,191,191,1)
"
,
'
rgba(191,191,191,1)
'
],
"
rgba(191,191,191,1)
"
,
],
backgroundColor
:
[
backgroundColor
:
[
'
rgba(75,192,192,0.4)
'
,
"
rgba(75,192,192,0.4)
"
,
'
rgba(75,192,192,0.4)
'
,
"
rgba(75,192,192,0.4)
"
,
'
rgba(75,192,192,0.4)
'
,
"
rgba(75,192,192,0.4)
"
,
'
rgba(75,192,192,0.4)
'
,
"
rgba(75,192,192,0.4)
"
,
'
rgba(75,192,192,0.4)
'
,
"
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)
'
,
"
rgba(191,191,191,0.4)
"
,
'
rgba(191,191,191,0.4)
'
]
"
rgba(191,191,191,0.4)
"
,
}
],
]
},
],
};
};
return
(
return
(
<
Col
id
=
'
chartTab
'
>
<
Col
id
=
"
chartTab
"
>
<
Bar
<
Bar
data
=
{
data
}
options
=
{
options
}
/
>
data
=
{
data
}
options
=
{
options
}
/
>
<
/Col
>
<
/Col
>
)
)
;
}
;
}
export
default
ChartTemp
;
export
default
ChartTemp
;
server/src/db/locationSetting.js
View file @
94720bc6
...
@@ -60,15 +60,15 @@ export const setLocTables = () => {
...
@@ -60,15 +60,15 @@ export const setLocTables = () => {
// Insert to DB.
// Insert to DB.
doeList
.
map
(
async
(
node
)
=>
{
doeList
.
map
(
async
(
node
)
=>
{
await
db
.
Doe
.
create
(
node
,
{
logging
:
false
});
await
db
.
Doe
.
findOrCreate
({
where
:
node
,
logging
:
false
});
});
});
sggList
.
map
(
async
(
node
)
=>
{
sggList
.
map
(
async
(
node
)
=>
{
await
db
.
Sgg
.
create
(
node
,
{
logging
:
false
});
await
db
.
Sgg
.
findOrCreate
({
where
:
node
,
logging
:
false
});
});
});
emdList
.
map
(
async
(
node
)
=>
{
emdList
.
map
(
async
(
node
)
=>
{
await
db
.
Emd
.
create
(
node
,
{
logging
:
false
});
await
db
.
Emd
.
findOrCreate
({
where
:
node
,
logging
:
false
});
});
});
console
.
log
(
"
Finish the insertion!
"
);
console
.
log
(
"
Finish the insertion!
"
);
...
...
server/src/init.js
View file @
94720bc6
...
@@ -12,7 +12,7 @@ const handleListening = () => {
...
@@ -12,7 +12,7 @@ const handleListening = () => {
// DB 연결
// DB 연결
db
.
sequelize
db
.
sequelize
.
sync
(
{
force
:
true
}
)
.
sync
()
.
then
(()
=>
{
.
then
(()
=>
{
console
.
log
(
db
.
msg
.
connection_success
);
console
.
log
(
db
.
msg
.
connection_success
);
})
})
...
...
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