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
Field Science
datavis
Commits
34d3135e
Commit
34d3135e
authored
Feb 17, 2020
by
Porter Libby
Browse files
clean up
parent
eeba1362
Changes
3
Hide whitespace changes
Inline
Side-by-side
public/js/data.js
View file @
34d3135e
...
...
@@ -267,8 +267,7 @@ function getReadings(spot_id,value){
}
console
.
info
(
'
DATA - readings
'
);
console
.
info
(
query_selection
);
console
.
info
(
'
Loaded
'
+
readings
.
length
+
"
points.
"
);
console
.
info
(
'
Loaded
'
+
readings
.
length
+
"
data points.
"
);
var
color
=
getRandomColor
();
query_data
=
processReadings
(
readings
);
...
...
@@ -531,9 +530,7 @@ function togglediv(target_div,btn_span){
}
}
function
processReadings
(
readings
){
console
.
log
(
readings
);
spotids
=
query_selection
[
3
];
console
.
log
(
spotids
);
spots_out
=
[];
for
(
x
=
0
;
x
<
spotids
.
length
;
x
++
){
current_data
=
[];
...
...
@@ -543,7 +540,6 @@ function processReadings(readings){
}
}
if
(
current_data
.
length
!=
0
){
console
.
log
(
current_data
);
const
timestamps
=
[...
new
Set
(
current_data
.
map
(
item
=>
item
.
recordtime
))];
// use earlier date to base data on;
var
min
=
timestamps
.
reduce
(
function
(
a
,
b
)
{
return
a
<
b
?
a
:
b
;
});
...
...
public/js/graph.js
View file @
34d3135e
...
...
@@ -25,8 +25,6 @@ $( document ).ready(function() {
});
});
function
createGraphReading
(
dataset
,
q_arr
,
color
){
console
.
log
(
"
TABLE INFO
"
);
console
.
log
(
dataset
);
//reset containers
document
.
getElementById
(
'
readingStats
'
).
style
.
display
=
'
block
'
;
document
.
getElementById
(
'
line-chart
'
).
style
.
display
=
'
none
'
;
...
...
@@ -49,24 +47,19 @@ function createGraphReading(dataset, q_arr, color){
var
keys
=
Object
.
keys
(
dataset
[
0
]);
tableHTML
+=
createTableHeader
(
keys
);
console
.
log
(
dataset
);
for
(
x
=
0
;
x
<
dataset
.
length
;
x
++
){
console
.
log
(
x
);
prop_arr
=
[];
for
(
y
=
0
;
y
<
keys
.
length
;
y
++
){
prop_arr
.
push
(
dataset
[
x
][
keys
[
y
]]);
}
tableHTML
+=
createTableRow
(
prop_arr
);
}
// append table to parent
console
.
log
(
tableHTML
);
table
.
innerHTML
=
tableHTML
;
parent
.
append
(
table
);
}
function
createTableRow
(
arr
){
console
.
log
(
arr
);
text
=
'
<tr>
'
;
for
(
j
=
0
;
j
<
arr
.
length
;
j
++
){
text
+=
"
<td>
"
+
arr
[
j
]
+
"
</td>
"
...
...
@@ -75,7 +68,6 @@ function createTableRow(arr){
return
text
;
}
function
createTableHeader
(
arr
){
console
.
log
(
arr
);
text
=
'
<tr>
'
;
for
(
j
=
0
;
j
<
arr
.
length
;
j
++
){
text
+=
"
<th>
"
+
arr
[
j
]
+
"
</th>
"
...
...
public/js/util.js
View file @
34d3135e
...
...
@@ -46,7 +46,6 @@ function switchToData(){
// generalized formula
function
createRadioElement
(
name
,
id
,
label
,
f
){
console
.
log
(
name
,
id
,
label
);
var
radioHtml
=
'
<div class="elem-div elem-0">
'
if
(
typeof
id
===
'
string
'
||
id
instanceof
String
){
radioHtml
+=
'
<input class="data-radio form-radio" onchange="
'
+
f
+
'
(
'
;
...
...
@@ -84,7 +83,6 @@ function createRadioElementSectors( mode, name, checked, label, id ) {
function
createRadioElementSpots
(
mode
,
name
,
checked
,
label
,
id
)
{
var
f
=
"
getReadings
"
;
//return createRadioElement(name, id, label, f);
console
.
log
(
name
,
id
,
label
);
var
radioHtml
=
'
<div class="elem-div elem-0">
'
if
(
typeof
id
===
'
string
'
||
id
instanceof
String
){
radioHtml
+=
'
<input class="data-radio form-check" onchange="
'
+
f
+
'
(
'
;
...
...
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