Sleep and Steps

- added sleep
- added steps
- bertter DB filling
This commit is contained in:
2018-09-23 18:39:59 +02:00
parent c807c474c4
commit a1019dd62e
17 changed files with 386 additions and 69 deletions

View File

@@ -1,5 +1,4 @@
@model IEnumerable<Heartbeat>
@{
@{
ViewBag.Title = "Hello Razor";
}

View File

@@ -0,0 +1,42 @@
@{
ViewBag.Title = "Hello Razor";
}
<div id="grid"></div>
<script>
$(document).ready(function () {
var baseUrl = "@Url.Content("~/api/sleep/")";
$("#grid").kendoGrid({
dataSource: {
transport: {
read: { url: baseUrl, type: "GET" }
},
serverPaging: false,
serverSorting: false,
batch: false,
schema: {
model: {
id: "username",
fields: {
username: { type: "string", },
time: { type: "date" },
value: { type: "number" }
}
}
}
},
scrollable: true,
sortable: true,
filterable: true,
editable: false,
columns: [
{ field: "username", title: "Username" },
{ field: "time", title: "Date/Time", format: "{0:dd/MM/yyyy HH:mm}" },
{ field: "value", title: "Sleep Time", format: "{n2}", template: '${value/3600000}' }
]
});
})
</script>

View File

@@ -0,0 +1,42 @@
@{
ViewBag.Title = "Hello Razor";
}
<div id="grid"></div>
<script>
$(document).ready(function () {
var baseUrl = "@Url.Content("~/api/step/")";
$("#grid").kendoGrid({
dataSource: {
transport: {
read: { url: baseUrl, type: "GET" }
},
serverPaging: false,
serverSorting: false,
batch: false,
schema: {
model: {
id: "username",
fields: {
username: { type: "string", },
time: { type: "date" },
value: { type: "number" }
}
}
}
},
scrollable: true,
sortable: true,
filterable: true,
editable: false,
columns: [
{ field: "username", title: "Username" },
{ field: "time", title: "Date/Time", format: "{0:dd/MM/yyyy HH:mm}" },
{ field: "value", title: "Steps done" }
]
});
})
</script>

View File

@@ -0,0 +1,82 @@
@model string
@{
ViewBag.Title = "Hello Razor";
}
<div id="chart"></div>
<script>
var base_url = "@Url.Content("~/api/")";
$("#chart").kendoChart({
title: { text: "Visualizzazione attivita' di @Model" },
legend: { position: "bottom" },
dataSource: {
transport: {
read: {
url: base_url+"heartbeat/@Model/last/48",
type: "GET",
dataType: "json"
}
},
sort: {
field: "time",
dir: "asc"
}
},
seriesDefaults: {
type: "line",
style: "smooth"
},
series: [{
name: "Battito",
field: "value",
categoryField: "time",
format: "0:{dd HH:mm}"
}],
/*series: [{
type: "column",
field: "value",
categoryField: "time"
}, {
name: "Steps",
dataSource: {
transport: {
read: {
url: "/api/steps/",
dataType: "json"
}
},
sort: {
field: "time",
dir: "asc"
}
}
}],
/*
valueAxis: {
labels: {
format: "{0}%"
},
line: {
visible: false
},
axisCrossingValue: -10
},
categoryAxis: {
categories: [2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011],
majorGridLines: {
visible: false
},
labels: {
rotation: "auto"
}
},
tooltip: {
visible: true,
format: "{0}%",
template: "#= series.name #: #= value #"
}*/
});
</script>