Browse Source

Created a fitbit heart rate sensor viewer.

master
jrtechs 5 years ago
parent
commit
465bc823d7
29 changed files with 54875 additions and 0 deletions
  1. +138
    -0
      fitbitVisualizer.html
  2. +2
    -0
      lib/jquery-3.3.1.min.js
  3. +7
    -0
      lib/moment.min.js
  4. BIN
      vis/img/network/acceptDeleteIcon.png
  5. BIN
      vis/img/network/addNodeIcon.png
  6. BIN
      vis/img/network/backIcon.png
  7. BIN
      vis/img/network/connectIcon.png
  8. BIN
      vis/img/network/cross.png
  9. BIN
      vis/img/network/cross2.png
  10. BIN
      vis/img/network/deleteIcon.png
  11. BIN
      vis/img/network/downArrow.png
  12. BIN
      vis/img/network/editIcon.png
  13. BIN
      vis/img/network/leftArrow.png
  14. BIN
      vis/img/network/minus.png
  15. BIN
      vis/img/network/plus.png
  16. BIN
      vis/img/network/rightArrow.png
  17. BIN
      vis/img/network/upArrow.png
  18. BIN
      vis/img/network/zoomExtends.png
  19. +34
    -0
      vis/vis-graph3d.min.js
  20. +1
    -0
      vis/vis-network.min.css
  21. +42
    -0
      vis/vis-network.min.js
  22. +1
    -0
      vis/vis-timeline-graph2d.min.css
  23. +40
    -0
      vis/vis-timeline-graph2d.min.js
  24. +1448
    -0
      vis/vis.css
  25. +53113
    -0
      vis/vis.js
  26. +1
    -0
      vis/vis.js.map
  27. +1
    -0
      vis/vis.map
  28. +1
    -0
      vis/vis.min.css
  29. +46
    -0
      vis/vis.min.js

+ 138
- 0
fitbitVisualizer.html View File

@ -0,0 +1,138 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="lib/moment.min.js"></script>
<link href="vis/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
<script src="vis/vis.js"></script>
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<div id="heartRateGraph"></div>
<body>
<div class="container">
<div class="row">
<div class="col-4 shadow-lg p-3 bg-white rounded">
<input type="file" id="files" name="files[]" multiple />
<output id="list"></output>
</div>
</div>
<div class="row">
</div>
</div>
</body>
<footer>
<script>
function generateHeartRateGraph(jsonFiles)
{
/*
var container = document.getElementById('heartRateGraph');
var items = [
{x: '2014-06-11', y: 10},
{x: '2014-06-12', y: 25},
{x: '2014-06-13', y: 30},
{x: '2014-06-14', y: 10},
{x: '2014-06-15', y: 15},
{x: '2014-06-16', y: 30}
];
var dataset = new vis.DataSet(items);
var options = {
start: '2014-06-10',
end: '2014-06-18'
};
var graph2d = new vis.Graph2d(container, dataset, options);
*/
console.log(jsonFiles);
var items = [];
for(var i = 0; i < jsonFiles.length; i++)
{
console.log(jsonFiles[i].length);
for(var j = 0; j < jsonFiles[i].length; j++)
{
//console.log(jsonFiles[i][j]);
items.push({y:jsonFiles[i][j].value.bpm, x:jsonFiles[i][j].dateTime})
}
}
var dataset = new vis.DataSet(items);
var options = {
dataAxis: {
showMinorLabels: true,
left: {
title: {
text: "Heart Rate"
}
}
}
};
var container = document.getElementById("heartRateGraph");
var graph2d = new vis.Graph2d(container, dataset, options);
console.log(items);
}
function handleFileSelect(evt)
{
var files = evt.target.files; // FileList object
// files is a FileList of File objects. List some properties.
var output = [];
var promises = [];
for (var i = 0, f; f = files[i]; i++)
{
output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ',
f.size, ' bytes, last modified: ',
f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a',
'</li>');
promises.push(new Promise((resolve, reject)=>
{
var reader = new FileReader();
reader.onload = function(e)
{
resolve(JSON.parse(reader.result));
};
reader.onerror= function(e)
{
reject(e);
};
reader.readAsBinaryString(files[i]);
//console.log(f);
}));
}
document.getElementById('list').innerHTML = '<ul>' + output.join('') + '</ul>';
Promise.all(promises).then((data)=>
{
generateHeartRateGraph(data);
}).catch((error)=>
{
console.log(error);
console.log("Unable to Load Data");
})
}
document.getElementById('files').addEventListener('change', handleFileSelect, false);
</script>
</footer>
</html>

+ 2
- 0
lib/jquery-3.3.1.min.js
File diff suppressed because it is too large
View File


+ 7
- 0
lib/moment.min.js
File diff suppressed because it is too large
View File


BIN
vis/img/network/acceptDeleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
vis/img/network/addNodeIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
vis/img/network/backIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
vis/img/network/connectIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
vis/img/network/cross.png View File

Before After
Width: 7  |  Height: 7  |  Size: 18 KiB

BIN
vis/img/network/cross2.png View File

Before After
Width: 5  |  Height: 5  |  Size: 17 KiB

BIN
vis/img/network/deleteIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
vis/img/network/downArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
vis/img/network/editIcon.png View File

Before After
Width: 24  |  Height: 24  |  Size: 20 KiB

BIN
vis/img/network/leftArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
vis/img/network/minus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.0 KiB

BIN
vis/img/network/plus.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.2 KiB

BIN
vis/img/network/rightArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
vis/img/network/upArrow.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

BIN
vis/img/network/zoomExtends.png View File

Before After
Width: 30  |  Height: 30  |  Size: 4.4 KiB

+ 34
- 0
vis/vis-graph3d.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
vis/vis-network.min.css
File diff suppressed because it is too large
View File


+ 42
- 0
vis/vis-network.min.js
File diff suppressed because it is too large
View File


+ 1
- 0
vis/vis-timeline-graph2d.min.css
File diff suppressed because it is too large
View File


+ 40
- 0
vis/vis-timeline-graph2d.min.js
File diff suppressed because it is too large
View File


+ 1448
- 0
vis/vis.css
File diff suppressed because it is too large
View File


+ 53113
- 0
vis/vis.js
File diff suppressed because it is too large
View File


+ 1
- 0
vis/vis.js.map
File diff suppressed because it is too large
View File


+ 1
- 0
vis/vis.map
File diff suppressed because it is too large
View File


+ 1
- 0
vis/vis.min.css
File diff suppressed because it is too large
View File


+ 46
- 0
vis/vis.min.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save