add heartRate Graph

merging_APE
Antoine PEREDERII 1 year ago
parent 9e57169ae6
commit 6786eea1c4

@ -67,6 +67,7 @@
<td>{{analyze.max}} Bpm</td> <td>{{analyze.max}} Bpm</td>
<td>{{analyze.min}} Bpm</td> <td>{{analyze.min}} Bpm</td>
<td>{{analyze.temperature}} °C</td> <td>{{analyze.temperature}} °C</td>
<td>{{analyze.idactivity}} °C</td>
<td><a href="/analyze?id={{ analyze.idactivity }}">En savoir plus</a></td> <td><a href="/analyze?id={{ analyze.idactivity }}">En savoir plus</a></td>
</tr> </tr>
{% endfor %} {% endfor %}

@ -47,10 +47,85 @@
</tbody> </tbody>
{% endfor %} {% endfor %}
</table> </table>
{# <div>#}
{# <canvas id="myChart" width="400" height="200">#}
{# <p>Hello Fallback World</p>#}
{# </canvas>#}
{# </div>#}
{# <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>#}
{# <script>#}
{# const ctx = document.getElementById('myChart');#}
{# new Chart(ctx, {#}
{# type: 'line',#}
{# data: {#}
{# labels: [#}
{# {% for analyze in analyzes %}#}
{# {{analyze.temps}}#}
{# {% endfor %}#}
{# ],#}
{# datasets: [{#}
{# label: 'Batement par minute',#}
{# data: [#}
{# {% for analyze in analyzes %}#}
{# {{analyze.bpm}}#}
{# {% endfor %}#}
{# ],#}
{# borderWidth: 1#}
{# }]#}
{# },#}
{# options: {#}
{# scales: {#}
{# y: {#}
{# beginAtZero: true#}
{# }#}
{# }#}
{# }#}
{# });#}
{# </script>#}
<div>
<canvas id="myChart" width="400" height="200">
<p>Hello Fallback World</p>
</canvas>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const ctx = document.getElementById('myChart');
const labels = [
{% for analyze in analyzes %}
'{{ analyze.temps }}',
{% endfor %}
];
const data = [
{% for analyze in analyzes %}
{{ analyze.bpm }},
{% endfor %}
];
new Chart(ctx, {
type: 'line',
data: {
labels: labels,
datasets: [{
label: 'Batement par minute',
data: data,
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: false
}
}
}
});
</script>
<div class="card-body"> <div class="card-body">
<div id="map" style="height: 500px;"></div> <div id="map" style="height: 500px;"></div>
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
{#var lat = {{ analyze.latitude }}#}
var map = L.map('map').setView([45.75771709151474, 3.113484980409329], 14); var map = L.map('map').setView([45.75771709151474, 3.113484980409329], 14);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors' attribution: '© OpenStreetMap contributors'

Loading…
Cancel
Save