Commit 127d11e4 authored by Porter Libby's avatar Porter Libby
Browse files

add data type selector

parent d68b42d0
......@@ -4,6 +4,10 @@ html, body, #viewDiv, #mapView, #graphView, #dataView{
height: 100%;
width: 100%;
}
#graph{
width: 100%;
height: 100%;
}
#mapcontrols{
margin-right: 10px;
margin-bottom: 20px;
......
......@@ -12,7 +12,7 @@
var mapstate = 0; // keep track of which map overlay is being used
var default_center = [-13.7055,65.2941]; //default starting coords for the map view
function mapReady(){ // placeholder for now
function ready(){ // placeholder for now
switchToData()
}
require(["esri/Map", "esri/views/SceneView", "esri/views/MapView", "esri/Graphic", "esri/widgets/BasemapToggle", "esri/widgets/CoordinateConversion", "esri/PopupTemplate" ], function(
......@@ -80,10 +80,15 @@ require(["esri/Map", "esri/views/SceneView", "esri/views/MapView", "esri/Graphic
// DATA //
// Arrays (hold on the the db information that gets fetched)
var query_selection = [null,null,null,null];
var query_selection = [null,null,null,null]; // trip, site, sector, spot
// Gets
function getTrips(){
document.getElementById('data-prompt').innerHTML = "Pick a trip, site, sector, and spot."
document.getElementById('trips').innerHTML = "";
document.getElementById('sites').innerHTML = "";
document.getElementById('sectors').innerHTML = "";
document.getElementById('spots').innerHTML = "";
$.ajax({
type: 'GET',
url: '/trips',
......@@ -294,13 +299,10 @@ function renderStreamings(streamings){
adjusted_time = streamings[x].recordtime.split('T')[0];
array_host.push(streamings[x].hostid);
}
trimmed_array = [...new Set(array)]
trimmed_array = [...new Set(array_host)]
console.log(trimmed_array);
}
function onlyUnique(value, index, self) {
return self.indexOf(value) === index;
}
function togglediv(target_div,btn_span){
var btn = document.getElementById(btn_span);
......@@ -311,3 +313,25 @@ function togglediv(target_div,btn_span){
}
$(target_div).slideToggle();
}
// GRAPH
$('document').ready(function(){
new Chart(document.getElementById("line-chart"), {
type: 'line',
data: {
},
options: {
responsive: true,
maintainAspectRatio: false,
title: {
display: true,
text: 'no data'
}
}
});
});
\ No newline at end of file
......@@ -24,7 +24,6 @@ function switchToData(){
document.getElementById("mapView").style.display = "none";
document.getElementById("graphView").style.display = "none";
document.getElementById("dataView").style.display = "block";
getTrips();
console.log('switched to data view');
}
......@@ -71,5 +70,5 @@ function createRadioElementSpots( mode, name, checked, label,spotid ) {
return radioHtml;
}
function createRadioElementStreamings( mode, name, checked, streaming ) {
}
\ No newline at end of file
......@@ -7,6 +7,7 @@
<link rel="stylesheet" href="https://js.arcgis.com/4.12/esri/css/main.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<script src="https://js.arcgis.com/4.12/"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/util.js"></script>
......@@ -41,7 +42,7 @@
<div id='graphView'>
<div id='graph'>
graph
<canvas id="line-chart"></canvas>
</div>
<div id='navcontrols'>
<input
......@@ -69,6 +70,15 @@
<div id='dataView'>
<div id='data'>
<div class='data-catagory'>
<div class='data-header' style='padding-bottom:15px; background-color: #bbb'>
<input class="data-radio form-radio" onchange="getTrips();" type="radio" name="data-type" id="readings"/>
<label for="readings"><strong>Readings from Fieldday</strong></label>
<input class="data-radio form-radio" onchange="getTrips();" type="radio" name="data-type" id="streamings"/>
<label for="streamings"><strong>Stream data from Platforms</strong></label>
</div>
</div>
<div class='data-catagory' id='trips'></div>
<div class='data-catagory' id='sites'></div>
<div class='data-catagory' id='sectors'></div>
......@@ -104,7 +114,8 @@
</div>
</div>
<script>
mapReady();
ready();
</script>
</body>
</html>
sites
\ No newline at end of file
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