| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <% layout("/sk/history/layout") %>
- <%~ include("/sk/partials/topbar") %>
- <h2>história <%= it?.property %></h2>
- <%= JSON.stringify(it.data[0]) %>
- <% const time = [] %>
- <% const data = [] %>
- <% for (const item of it.data) { %>
- <% time.push(item.timeMark) %>
-
- <% if (it.property === "outdoorConnected") {%>
- <% data.push(item.value) %>
- <% continue %>
- <% } %>
- <% data.push(item.value / 100) %>
- <% } %>
- <div>
- <canvas id="historyChart"></canvas>
- </div>
- <script>
- const ctx = document.getElementById('historyChart');
- new Chart(ctx, {
- type: 'bar',
- data: {
- labels: <%~ JSON.stringify(time) %>,
- datasets: [{
- label: `<%= it.property %>`,
- data: <%~ JSON.stringify(data) %>,
- borderWidth: 1
- }]
- },
- options: {
- scales: {
- y: {
- beginAtZero: true
- }
- }
- }
- });
- </script>
|