Commit adecec1c authored by Spark's avatar Spark
Browse files

3743011 default 값 두기

parent 46008734
......@@ -151,7 +151,7 @@ ul li .nav-link:active {
}
#chartTab {
width: 100%;
height: 70vh;
height: 60vh;
display: flex;
}
......
......@@ -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
}
......
......@@ -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>
)
......
......@@ -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}>
......
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
......@@ -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'>
......
......@@ -76,7 +76,7 @@ function UserInfo() {
}, []);
return (
<Col className="text-center pb-2 px-0">
<Col className="text-center pt-2 px-0">
<Card style={cardstyled} id="localName">
<Card.Title>
<strong>
......
......@@ -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',
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment