Sleep and Steps
- added sleep - added steps - bertter DB filling
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
@model IEnumerable<Heartbeat>
|
||||
@{
|
||||
@{
|
||||
ViewBag.Title = "Hello Razor";
|
||||
}
|
||||
|
||||
|
||||
42
SeniorAssistant/Views/Home/Sleep.cshtml
Normal file
42
SeniorAssistant/Views/Home/Sleep.cshtml
Normal 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>
|
||||
42
SeniorAssistant/Views/Home/Step.cshtml
Normal file
42
SeniorAssistant/Views/Home/Step.cshtml
Normal 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>
|
||||
82
SeniorAssistant/Views/Home/User.cshtml
Normal file
82
SeniorAssistant/Views/Home/User.cshtml
Normal 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>
|
||||
Reference in New Issue
Block a user