Skip to content

Commit 2251798

Browse files
author
bottas
committed
Fixed a few bugs with the interface and the charts
1 parent 5abb5d9 commit 2251798

File tree

6 files changed

+28
-30
lines changed

6 files changed

+28
-30
lines changed

src/components/SensorView.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@ import { Line } from 'react-chartjs-2';
33

44
import '../styles/SensorView.scss'
55
import { fetchMoisture } from '../deviceAPI';
6-
7-
var timeInMs = Date.now(); //(ms) since 1 de janeiro de 1970 00:00:00 UTC
8-
const weekInMs = 518400000; //7 days 604800000 gives 8 results, using 6 days;
9-
var deviceID = ""
10-
const agregation = "day"
11-
const beginDate = timeInMs - weekInMs;
12-
const endDate = timeInMs;
6+
import calendar from '../resources/calendar.svg';
137

148
function SensorView(props: any) {
159
type ExpectedResponse = {
@@ -25,7 +19,12 @@ function SensorView(props: any) {
2519
y: number,
2620
}
2721

28-
deviceID = window.location.pathname.substring(15);
22+
var deviceID = window.location.pathname.substring(15);
23+
var timeInMs = Date.now(); //(ms) since 1 de janeiro de 1970 00:00:00 UTC
24+
const weekInMs = 518400000; //7 days 604800000 gives 8 results, using 6 days;
25+
const agregation = "day"
26+
const beginDate = timeInMs - weekInMs;
27+
const endDate = timeInMs;
2928

3029
const [response, setResponse] = useState<Array<ExpectedResponse> | undefined>();
3130
const [isVisible, setVisible] = useState([true, true, true, true]);
@@ -108,7 +107,6 @@ function SensorView(props: any) {
108107
}
109108

110109
var sumdata = {
111-
labels: ["Time Frame", "Dia", "Dia", "Dia"], //x-axis
112110
datasets: [{
113111
fill: false,
114112
label: "Total",
@@ -224,30 +222,23 @@ function SensorView(props: any) {
224222
}
225223
}
226224

227-
const options_sum = {
228-
229-
legend: {
230-
display: false,
231-
}
232-
}
233-
234-
235225
if (response !== undefined) {
236226
return (
237227
<div className="sensorview">
238228
<p className="title">Humidade do solo</p>
229+
<img src={calendar} className="date-picker-icon" alt="date-icon" />
239230
<Legend />
240231
<Line
241232
data={data}
242233
options={options}
243-
width={960}
244-
height={400}
234+
width={1560}
235+
height={380}
245236
/>
246237
<Line
247238
data={sumdata}
248-
options={options_sum}
249-
width={960}
250-
height={400}
239+
options={options}
240+
width={1560}
241+
height={380}
251242
/>
252243
</div>
253244
);

src/resources/calendar.svg

Lines changed: 3 additions & 0 deletions
Loading

src/styles/AppStyle.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ body {
8080

8181
.App-header {
8282
background-color: #EEEEEE;
83-
min-height: 100vh;
84-
display: flex;
83+
display: contents;
8584
flex-direction: column;
8685
align-items: center;
8786
justify-content: center;

src/styles/Area.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
background: rgb(255, 255, 255);
66
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.14);
77
border-radius: 2px;
8-
margin: auto;
98
margin-top: 16px;
109
}
1110

src/styles/AreaForm.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
background: rgb(255, 255, 255);
55
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.14);
66
border-radius: 2px;
7-
margin: auto;
8-
margin-top: 16px;
9-
margin-left: unset;
7+
margin-top: 16px;
8+
margin-left: unset;
109
text-align: unset;
1110
font-size:20px;
1211

src/styles/SensorView.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
background-color: white;
44

55
.title {
6+
float: left;
7+
margin-top: 10px;
68
font-style: normal;
79
font-weight: 500;
810
font-size: 16px;
911
padding-left: 15px;
10-
display: flex;
1112
color: #00c4b3;
1213
}
14+
15+
.date-picker-icon {
16+
float: right;
17+
margin-top: 10px;
18+
padding-right: 15px;
19+
}
1320
}
1421

1522
.legend-text {
@@ -35,10 +42,10 @@
3542

3643
ul {
3744
list-style-type: none;
45+
margin-top: 50px;
3846
margin-bottom: 15px;
3947
padding: 0;
4048
overflow: hidden;
41-
//background-color: #333;
4249
}
4350

4451
li {

0 commit comments

Comments
 (0)