Add BMI to height/weight graph
This commit is contained in:
parent
adaa3fe0e3
commit
8612ea9087
|
@ -235,6 +235,9 @@ class WellBeing(Markdownizable, Seasonisable):
|
||||||
Représente l'état psychologique/physique d'un gymnaste
|
Représente l'état psychologique/physique d'un gymnaste
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ["date", ]
|
||||||
|
|
||||||
gymnast = models.ForeignKey(
|
gymnast = models.ForeignKey(
|
||||||
Gymnast, on_delete=models.CASCADE, default=None, related_name="wellbeings"
|
Gymnast, on_delete=models.CASCADE, default=None, related_name="wellbeings"
|
||||||
)
|
)
|
||||||
|
|
|
@ -205,6 +205,13 @@
|
||||||
gradient_stroke_orange.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
|
gradient_stroke_orange.addColorStop(0.5, 'rgba(255, 159, 64, 0.2)');
|
||||||
gradient_stroke_orange.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
|
gradient_stroke_orange.addColorStop(0.25, 'rgba(255, 159, 64, 0)');
|
||||||
|
|
||||||
|
var border_color_green = 'rgb(75, 192, 192)';
|
||||||
|
var gradient_stroke_green = ctx.createLinearGradient(0, 230, 0, 50);
|
||||||
|
gradient_stroke_green.addColorStop(1, 'rgba(75, 192, 192, 0.4)');
|
||||||
|
gradient_stroke_green.addColorStop(0.75, 'rgba(75, 192, 192, 0.3)');
|
||||||
|
gradient_stroke_green.addColorStop(0.5, 'rgba(75, 192, 192, 0.2)');
|
||||||
|
gradient_stroke_green.addColorStop(0.25, 'rgba(75, 192, 192, 0)');
|
||||||
|
|
||||||
var height_values = [
|
var height_values = [
|
||||||
{% for height_weight in height_weight_list %}
|
{% for height_weight in height_weight_list %}
|
||||||
{
|
{
|
||||||
|
@ -223,6 +230,15 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var bmi_value = [
|
||||||
|
{% for height_weight in height_weight_list %}
|
||||||
|
{
|
||||||
|
x: '{{ height_weight.date | date:"d-m-Y" }}',
|
||||||
|
y: '{{ height_weight.bmi }}'
|
||||||
|
},
|
||||||
|
{% endfor %}
|
||||||
|
]
|
||||||
|
|
||||||
var height_weight_data = {
|
var height_weight_data = {
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
|
@ -233,6 +249,7 @@
|
||||||
pointBackgroundColor: border_color_pink,
|
pointBackgroundColor: border_color_pink,
|
||||||
fill: true,
|
fill: true,
|
||||||
data: height_values,
|
data: height_values,
|
||||||
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Height',
|
label: 'Height',
|
||||||
|
@ -241,7 +258,17 @@
|
||||||
borderColor: border_color_orange,
|
borderColor: border_color_orange,
|
||||||
pointBackgroundColor: border_color_orange,
|
pointBackgroundColor: border_color_orange,
|
||||||
fill: true,
|
fill: true,
|
||||||
data: weight_values
|
data: weight_values,
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'BMI',
|
||||||
|
cubicInterpolationMode: 'monotone',
|
||||||
|
backgroundColor: gradient_stroke_green,
|
||||||
|
borderColor: border_color_green,
|
||||||
|
pointBackgroundColor: border_color_green,
|
||||||
|
fill: true,
|
||||||
|
data: bmi_value,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue