Compare commits

...

2 Commits

Author SHA1 Message Date
Gregory Trullemans aafaeaa499 Update ChartJS to 3.9.1 2022-10-13 12:20:05 +02:00
Gregory Trullemans 5bd3dc47a8 [WIP] Update ChartJS to 3.9.1 2022-10-13 12:00:09 +02:00
13 changed files with 86 additions and 125 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -48,7 +48,7 @@
<!-- Chart JS -->
<script src="{% static "js/plugins/moment_2.29.1.min.js" %}"></script>
<script src="{% static "js/plugins/moment_locale_en-gb.js" %}"></script>
<script src="{% static "js/plugins/chartjs_2.9.4.min.js" %}"></script>
<script src="{% static "js/plugins/chartjs/chartjs_3.9.1.min.js" %}"></script>
<!-- FullCalendar CSS -->
<!-- <link href="{% static "js/plugins/fullcalendar/main.css" %}" rel="stylesheet" /> -->

View File

@ -5,7 +5,7 @@
<div class="card-header">
<div class="row">
<div class="col-8">
<h4 class=""> Chronos listing {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
<h4 class=""> Chronos listing {% if gymnast %}for <i><a href="{% url 'gymnast_details_tab' gymnast.id 'scores' %}">{{ gymnast }}</a></i>{% endif %}</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">

View File

@ -10,6 +10,11 @@
<h4 class="">{% if heightweight_id %}Edit{% else %}Add{% endif %} height/weight couple</h4>
</div>
<div class="card-body">
{% if form.errors %}
<div class="alert alert-danger">
{{ form.errors }}
</div>
{% endif %}
<form action="{% if heightweight_id %}{% url 'heightweight_update' heightweight_id %}{% else %}{% url 'heightweight_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
{% csrf_token %}
<div class="form-group row ">

View File

@ -7,7 +7,7 @@
<div class="card">
<div class="card-header row">
<div class="col-8">
<h4 class="">Height/Weight list {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
<h4 class="">Height/Weight list {% if gymnast %}for <a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}"><i>{{ gymnast }}</i></a>{% endif %}</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">

View File

@ -7,7 +7,7 @@
<div class="card">
<div class="card-header row">
<div class="col-8">
<h4 class="">Mind State list {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
<h4 class="">Mind State list {% if gymnast %}for <a href="{% url 'gymnast_details_tab' gymnast.id 'physiological' %}"><i>{{ gymnast }}</i></a>{% endif %}</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">
@ -41,7 +41,7 @@
</a>
</td>
<td class="text-left">{{ state.date | date:"d-m-Y" }}</td>
<td class="text-left"><a href="{% url 'gymnast_details' state.gymnast.id %}">{{ state.gymnast }}</a></td>
<td class="text-left"><a href="{% url 'gymnast_details_tab' state.gymnast.id 'physiological' %}">{{ state.gymnast }}</a></td>
<td>{{ state.score }}</td>
</tr>
{% endfor %}

View File

@ -7,7 +7,7 @@
<div class="card">
<div class="card-header row">
<div class="col-8">
<h4 class="">Scores listing {% if gymnast %}for <i>{{ gymnast }}</i>{% endif %}</h4>
<h4 class="">Scores listing {% if gymnast %}for <a href="{% url 'gymnast_details_tab' gymnast.id 'scores' %}"><i>{{ gymnast }}</i></a>{% endif %}</h4>
</div>
<div class="col-1 ml-auto">
<div class="text-right">

View File

@ -29,8 +29,10 @@
type: "doughnut",
data: completude_data,
options: {
legend: {
display: false,
plugins: {
legend: {
display: false,
},
},
cutoutPercentage: 55,
maintainAspectRatio: false,

View File

@ -7,7 +7,7 @@
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if height_weight_list %}
<div>
<canvas id="chartjs_height_weight_state" class="chartjs" width="400" height="200"></canvas>
<canvas id="chart_height_weight_state" class="chartjs" width="400" height="200"></canvas>
</div>
{% else %}
<p class="pl-3 text-muted">No height/weight recorded for this gymnast.</p>
@ -38,7 +38,7 @@
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if mindstate_list %}
<div>
<canvas id="chartjs_mindstate" class="chartjs" width="400" height="200"></canvas>
<canvas id="chart_mindstate" class="chartjs" width="400" height="200"></canvas>
</div>
{% else %}
<p class="pl-3 text-muted">No mindstate recorded for this gymnast.</p>
@ -104,7 +104,7 @@
<i class="tim-icons icon-simple-add"></i>
</button>
</a>
</div>
</div>
</div>
</div>
</div>
@ -122,7 +122,7 @@
// }
// }];
var ctx = document.getElementById("chartjs_height_weight_state").getContext("2d");
var ctx = document.getElementById("chart_height_weight_state").getContext("2d");
var gradientStroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
var gradientStroke_2 = ctx.createLinearGradient(0, 230, 0, 50);
@ -141,6 +141,7 @@
{% if height_weight_list %}
{
label: 'Weight',
cubicInterpolationMode: 'monotone',
backgroundColor: gradientStroke_1,
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)',
@ -156,6 +157,7 @@
},
{
label: 'Height',
cubicInterpolationMode: 'monotone',
backgroundColor: gradientStroke_2,
borderColor: 'rgb(255, 159, 64)',
pointBackgroundColor: 'rgb(255, 159, 64)',
@ -173,7 +175,7 @@
],
};
new Chart(document.getElementById("chartjs_height_weight_state"),{
new Chart(ctx,{
// tooltips: {
// backgroundColor: '#f5f5f5',
// titleFontColor: '#333',
@ -205,14 +207,16 @@
},
}],
},
legend: {
display: true,
position: 'bottom',
plugins: {
legend: {
display: true,
position: 'bottom',
}
}
},
});
var ctx = document.getElementById("chartjs_mindstate").getContext("2d");
var ctx = document.getElementById("chart_mindstate").getContext("2d");
var gradient_stroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
gradient_stroke_1.addColorStop(1, 'rgba(75, 192, 192, 0.4)');
@ -225,6 +229,7 @@
{% if mindstate_list %}
{
label: 'Mindstate',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_1,
borderColor: 'rgb(75, 192, 192)',
pointBackgroundColor: 'rgb(75, 192, 192)',
@ -242,7 +247,7 @@
],
};
new Chart(document.getElementById("chartjs_mindstate"),{
new Chart(ctx,{
type: 'line',
data: mindstate_data,
options: {
@ -267,8 +272,10 @@
}
}]
},
legend: {
display: false,
plugins: {
legend: {
display: false,
}
}
},
});

View File

@ -10,91 +10,8 @@
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if score_list %}
<div>
<canvas id="chartjs_routine" class="chartjs" width="400" height="200"></canvas>
<canvas id="chart_score_competition" class="chartjs" width="400" height="200"></canvas>
</div>
<!-- <table class="table tablesorter table-striped table-condensed" id="scores_table">
<thead>
<tr>
<th style="width: 3%"></th>
<th style="width: 35%" class="header text-left">Event</th>
<th style="width: 10%" class="header text-center">Date</th>
<th style="width: 10%" class="header text-center">Routine</th>
<th style="width: 7%" class="header text-center">Exe.</th>
<th style="width: 7%" class="header text-center">Dif.</th>
<th style="width: 7%" class="header text-center">ToF</th>
<th style="width: 7%" class="header text-center">HD</th>
<th style="width: 7%" class="header text-center">Pen.</th>
<th style="width: 7%" class="header text-center">Total</th>
</tr>
</thead>
<tbody>
{% for score in score_list %}
<tr class="routine_{{ score.routine_type }}">
<td>
<a href="{% url 'score_update' score.id %}">
<button type="button" rel="tooltip" class="btn btn-link btn-sm btn-icon">
<span class="tim-icons icon-pencil text-warning"></span>
</button>
</a>
</td>
<td class="text-left"><a href="{% url 'event_details' score.event.id %}">{{ score.event.name }}</a></td>
<td class="text-right">{{ score.event.date_begin | date:"d-m-Y" }}</td>
<td class="text-right">{{ score.get_routine_type_display }}</td>
<td class="text-right">{{ score.point_execution }}</td>
<td class="text-right">{{ score.point_difficulty }}</td>
<td class="text-right">{{ score.point_time_of_flight }}</td>
<td class="text-right">{{ score.point_horizontal_displacement }}</td>
<td class="text-center">-{% if score.penality > 0 %}{{ score.penality }}{% endif %}</td>
<td class="text-right"><b>{{ score.total }}</b></td>
</tr>
{% endfor %}
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$('#scores_table').tablesorter({
headers: {
0: { sorter: false },
},
dateFormat: "uk",
sortList: [[2,0],]
});
$('#checkbox_l1, #checkbox_l2, #checkbox_l3').change(function(){
if($('#checkbox_l1').is(':checked'))
$('.routine_0').show();
else
$('.routine_0').hide();
if($('#checkbox_l2').is(':checked'))
$('.routine_1').show();
else
$('.routine_1').hide();
if($('#checkbox_l3').is(':checked'))
$('.routine_2').show();
else
$('.routine_2').hide();
{% if request.session.template == 1 %}
// now add stripes to alternating rows
$("#scores_table tr:visible").each(function(index){
// but first remove color that may have been added by previous changes:
$(this).css("background-color", "inherit");
if(index % 2 != 0)
$(this).css("background-color", "#f9f9f9");
});
{% endif %}
});
});
</script>
</div>
<div class="card-footer text-muted pt-0 text-center">
L1 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l1" checked />
L2 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l2" checked />
L3 <input type="checkbox" name="checkbox" class="bootstrap-switch" id="checkbox_l3" checked />
</div> -->
{% else %}
<p class="pl-3 text-muted">No score recorded for this gymnast.</p>
{% endif %}
@ -128,7 +45,7 @@
<div class="card-body pt-0 pb-0 pr-0 pl-0">
{% if chrono_list %}
<div>
<canvas id="chartjs_chrono" class="chartjs" width="400" height="200"></canvas>
<canvas id="chart_chrono" class="chartjs" width="400" height="200"></canvas>
</div>
{% else %}
<p class="pl-3 text-muted">No chrono recorded for this gymnast.</p>
@ -157,7 +74,7 @@
<script type="text/javascript">
{% if score_list %}
var ctx = document.getElementById("chartjs_routine").getContext("2d");
var ctx = document.getElementById('chart_score_competition').getContext('2d');
var gradient_stroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
var gradient_stroke_2 = ctx.createLinearGradient(0, 230, 0, 50);
var gradient_stroke_3 = ctx.createLinearGradient(0, 230, 0, 50);
@ -177,13 +94,14 @@
gradient_stroke_3.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)');
gradient_stroke_3.addColorStop(0.25, 'rgba(54, 162, 235, 0)');
new Chart(document.getElementById("chartjs_routine"),{
new Chart(ctx,{
type: 'line',
data:{
datasets:[
{% if score_routine1_list %}
{
label: 'R1',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_1,
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)',
@ -202,6 +120,7 @@
{% if score_routine2_list %}
{
label: 'R2',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_2,
borderColor: 'rgb(255, 159, 64)',
pointBackgroundColor: 'rgb(255, 159, 64)',
@ -220,6 +139,7 @@
{% if score_routine3_list %}
{
label: 'R3',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_3,
borderColor: 'rgb(54, 162, 235)',
pointBackgroundColor: 'rgb(54, 162, 235)',
@ -254,9 +174,11 @@
}
}]
},
legend: {
display: true,
position: 'bottom',
plugins: {
legend: {
display: true,
position: 'bottom',
}
}
},
});
@ -274,7 +196,7 @@
*/
{% if chrono_list %}
var ctx = document.getElementById("chartjs_chrono").getContext("2d");
var ctx = document.getElementById('chart_chrono').getContext('2d');
var gradient_stroke_1 = ctx.createLinearGradient(0, 230, 0, 50);
var gradient_stroke_2 = ctx.createLinearGradient(0, 230, 0, 50);
var gradient_stroke_3 = ctx.createLinearGradient(0, 230, 0, 50);
@ -299,13 +221,14 @@
gradient_stroke_4.addColorStop(0.5, 'rgba(54, 162, 235, 0.2)');
gradient_stroke_4.addColorStop(0.25, 'rgba(54, 162, 235, 0)');
new Chart(document.getElementById("chartjs_chrono"),{
new Chart(ctx,{
type: 'line',
data:{
datasets:[
{% if chrono_10c %}
{
label: '10 |',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_1,
borderColor: 'rgb(75, 192, 192)',
pointBackgroundColor: 'rgb(75, 192, 192)',
@ -324,6 +247,7 @@
{% if chrono_r1 %}
{
label: 'R1',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_2,
borderColor: 'rgb(255, 99, 132)',
pointBackgroundColor: 'rgb(255, 99, 132)',
@ -342,6 +266,7 @@
{% if chrono_r2 %}
{
label: 'R2',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_3,
borderColor: 'rgb(255, 159, 64)',
pointBackgroundColor: 'rgb(255, 159, 64)',
@ -360,6 +285,7 @@
{% if chrono_rf %}
{
label: 'R3',
cubicInterpolationMode: 'monotone',
backgroundColor: gradient_stroke_4,
borderColor: 'rgb(255, 205, 86)',
pointBackgroundColor: 'rgb(255, 205, 86)',
@ -395,9 +321,11 @@
}
}]
},
legend: {
display: true,
position: 'bottom',
plugins: {
legend: {
display: true,
position: 'bottom',
}
}
},
});

View File

@ -273,6 +273,9 @@
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="3">
<i class="far fa-link"></i>
</button>
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="4">
<i class="fal fa-thumbs-up"></i>
</button>
</td>
{% endif %}
<td>{{ skill.notation }}</td>
@ -293,7 +296,7 @@
<thead>
<tr>
{% if user_is_trainer %}
<th style="width: 13%">Actions</th>
<th style="width: 15%">Actions</th>
{% endif %}
<th style="width: 10%">Notation</th>
<th class="header text-left" style="width: 50%">Label</th>
@ -321,6 +324,9 @@
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="3">
<i class="far fa-link"></i>
</button>
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="4">
<i class="fal fa-thumbs-up"></i>
</button>
</td>
{% endif %}
<td>{{ skill.notation }}</td>
@ -370,6 +376,9 @@
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="3">
<i class="far fa-link"></i>
</button>
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="4">
<i class="fal fa-thumbs-up"></i>
</button>
</td>
{% endif %}
<td>{{ skill.notation }}</td>
@ -390,7 +399,7 @@
<thead>
<tr>
{% if user_is_trainer %}
<th style="width: 13%">Actions</th>
<th style="width: 15%">Actions</th>
{% endif %}
<th style="width: 10%">Notation</th>
<th class="header text-left" style="width: 50%">Label</th>
@ -418,6 +427,9 @@
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="3">
<i class="far fa-link"></i>
</button>
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="4">
<i class="fal fa-thumbs-up"></i>
</button>
</td>
{% endif %}
<td>{{ skill.notation }}</td>

View File

@ -528,9 +528,10 @@ def heightweight_create_or_update(request, heightweight_id=None, gymnast_id=None
if form.is_valid():
form.save()
return HttpResponseRedirect(
reverse("gymnast_details", args=(form.cleaned_data["gymnast"].id,))
reverse("gymnast_details_tab", args=(form.cleaned_data["gymnast"].id, 'physiological'))
)
else:
print(form.errors)
return render(request, "followup/heightweight/create.html", {"form": form})
form = HeightWeightForm(instance=heightweight, initial=data)