420 lines
14 KiB
HTML
420 lines
14 KiB
HTML
|
|
<div class="row justify-content-center ml-3 pr-0">
|
|
<div class="col-md-12 pr-0">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4>Chrono</h4>
|
|
</div>
|
|
<div class="card-body">
|
|
{% if chrono_list %}
|
|
<div>
|
|
<!-- <canvas id="chartSimpleWithGradient"></canvas> -->
|
|
<canvas id="chartjs_chrono" class="chartjs" width="400" height="200"></canvas>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<a href="{% url 'routine_create' %}">
|
|
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
|
<i class="tim-icons icon-simple-add"></i>
|
|
</button>
|
|
</a>
|
|
|
|
<!-- <div class="flextable table-actions">
|
|
<div class="flextable-item flextable-primary">
|
|
|
|
</div>
|
|
<div class="flextable-item">
|
|
<div class="btn-group">
|
|
<button type="button" class="btn btn-primary-outline">
|
|
<a href="{% url 'chrono_create_for_gym' gymnastid %}"><span class="icon icon-plus"></span></a>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
|
|
{% if chrono_list %}
|
|
<table class="table table-striped table-condensed tablesorter" id="chrono_table">
|
|
<thead>
|
|
<tr>
|
|
<th style="width: 5%"> </th>
|
|
<th style="width: 10%" class="header">Date</th>
|
|
<th style="width: 35%" class="header text-left">Routine</th>
|
|
<th style="width: 25%" class="header">Type</th>
|
|
<th style="width: 25%" class="header text-center">Score</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for chrono in chrono_list %}
|
|
<tr>
|
|
<td>
|
|
<a href="{% url 'chrono_update' chrono.id %}">
|
|
<span class="tim-icons icon-pencil text-warning"></span>
|
|
</a>
|
|
</td>
|
|
<td>{{ chrono.date | date:"d-m-Y" }}</a></td>
|
|
<td class="text-left"><a href="{% url 'routine_details' chrono.routine.id %}">{{ chrono.routine.longLabel }}</a></td>
|
|
<td>{{ chrono.get_routine_type_display }}</td>
|
|
<td class="text-center">{{ chrono.score }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$('#chrono_table').tablesorter({
|
|
headers: {
|
|
0: { sorter: false },
|
|
},
|
|
dateFormat: "uk",
|
|
sortList: [[1,1],]
|
|
});
|
|
});
|
|
</script>
|
|
{% else %}
|
|
No chrono results to display.
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
// gradientChartOptionsConfigurationPurple = {
|
|
// maintainAspectRatio: false,
|
|
// legend: {
|
|
// display: false
|
|
// },
|
|
|
|
// tooltips: {
|
|
// backgroundColor: '#f5f5f5',
|
|
// titleFontColor: '#333',
|
|
// bodyFontColor: '#666',
|
|
// bodySpacing: 4,
|
|
// xPadding: 12,
|
|
// mode: "nearest",
|
|
// intersect: 0,
|
|
// position: "nearest"
|
|
// },
|
|
// responsive: true,
|
|
// scales: {
|
|
// yAxes: [{
|
|
// barPercentage: 1.6,
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(186,84,245,0.1)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// suggestedMin: 60,
|
|
// suggestedMax: 125,
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }],
|
|
|
|
// xAxes: [{
|
|
// barPercentage: 1.6,
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(186,84,245,0.1)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }]
|
|
// }
|
|
// };
|
|
|
|
|
|
// gradientChartOptionsConfigurationBlue = {
|
|
// maintainAspectRatio: false,
|
|
// legend: {
|
|
// display: false
|
|
// },
|
|
|
|
// tooltips: {
|
|
// backgroundColor: '#f5f5f5',
|
|
// titleFontColor: '#333',
|
|
// bodyFontColor: '#666',
|
|
// bodySpacing: 4,
|
|
// xPadding: 12,
|
|
// mode: "nearest",
|
|
// intersect: 0,
|
|
// position: "nearest"
|
|
// },
|
|
// responsive: true,
|
|
// scales: {
|
|
// yAxes: [{
|
|
// barPercentage: 1.6,
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(29,140,248,0.0)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// suggestedMin: 60,
|
|
// suggestedMax: 125,
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }],
|
|
|
|
// xAxes: [{
|
|
// barPercentage: 1.6,
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(29,140,248,0.1)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }]
|
|
// }
|
|
// };
|
|
|
|
// gradientBarChartConfiguration = {
|
|
// maintainAspectRatio: false,
|
|
// legend: {
|
|
// display: false
|
|
// },
|
|
|
|
// tooltips: {
|
|
// backgroundColor: '#f5f5f5',
|
|
// titleFontColor: '#333',
|
|
// bodyFontColor: '#666',
|
|
// bodySpacing: 4,
|
|
// xPadding: 12,
|
|
// mode: "nearest",
|
|
// intersect: 0,
|
|
// position: "nearest"
|
|
// },
|
|
// responsive: true,
|
|
// scales: {
|
|
// yAxes: [{
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(253,93,147,0.1)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// suggestedMin: 60,
|
|
// suggestedMax: 125,
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }],
|
|
|
|
// xAxes: [{
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(253,93,147,0.1)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }]
|
|
// }
|
|
// };
|
|
|
|
// gradientBarChartConfigurationWithGrid = {
|
|
// maintainAspectRatio: false,
|
|
// legend: {
|
|
// display: false
|
|
// },
|
|
|
|
// tooltips: {
|
|
// backgroundColor: '#f5f5f5',
|
|
// titleFontColor: '#333',
|
|
// bodyFontColor: '#666',
|
|
// bodySpacing: 4,
|
|
// xPadding: 12,
|
|
// mode: "nearest",
|
|
// intersect: 0,
|
|
// position: "nearest"
|
|
// },
|
|
// responsive: true,
|
|
// scales: {
|
|
// yAxes: [{
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(253,93,147,0.1)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// suggestedMin: 60,
|
|
// suggestedMax: 125,
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }],
|
|
|
|
// xAxes: [{
|
|
// gridLines: {
|
|
// drawBorder: false,
|
|
// color: 'rgba(253,93,147,0.1)',
|
|
// zeroLineColor: "transparent",
|
|
// },
|
|
// ticks: {
|
|
// padding: 20,
|
|
// fontColor: "#9e9e9e"
|
|
// }
|
|
// }]
|
|
// }
|
|
// };
|
|
|
|
|
|
|
|
// var ctx = document.getElementById("chartSimpleWithGradient").getContext("2d");
|
|
|
|
// var gradientStroke = ctx.createLinearGradient(0, 230, 0, 50);
|
|
|
|
// gradientStroke.addColorStop(1, 'rgba(72,72,176,0.4)');
|
|
// gradientStroke.addColorStop(0.8, 'rgba(72,72,176,0.2)');
|
|
// gradientStroke.addColorStop(0, 'rgba(119,52,169,0)'); //purple colors
|
|
|
|
|
|
|
|
// var myChart = new Chart(ctx, {
|
|
// type: 'line',
|
|
// responsive: true,
|
|
// data: {
|
|
// labels: ['JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],
|
|
// datasets: [{
|
|
// label: "Data",
|
|
// fill: true,
|
|
// backgroundColor: gradientStroke,
|
|
// borderColor: '#ba54f5',
|
|
// borderWidth: 2,
|
|
// borderDash: [],
|
|
// borderDashOffset: 0.0,
|
|
// pointBackgroundColor: '#be55ed',
|
|
// pointBorderColor: 'rgba(255,255,255,0)',
|
|
// pointHoverBackgroundColor: '#be55ed',
|
|
// //pointHoverBorderColor:'rgba(35,46,55,1)',
|
|
// pointBorderWidth: 20,
|
|
// pointHoverRadius: 4,
|
|
// pointHoverBorderWidth: 15,
|
|
// pointRadius: 4,
|
|
// data: [80, 100, 70, 80, 120, 80],
|
|
// }]
|
|
// },
|
|
// options: gradientChartOptionsConfigurationPurple
|
|
// });
|
|
|
|
/*
|
|
red: 'rgb(255, 99, 132)',
|
|
orange: 'rgb(255, 159, 64)',
|
|
yellow: 'rgb(255, 205, 86)',
|
|
green: 'rgb(75, 192, 192)',
|
|
blue: 'rgb(54, 162, 235)',
|
|
purple: 'rgb(153, 102, 255)',
|
|
grey: 'rgb(201, 203, 207)'
|
|
|
|
http://www.chartjs.org/samples/latest/scales/time/line-point-data.html
|
|
*/
|
|
|
|
new Chart(document.getElementById("chartjs_chrono"),{
|
|
type: 'line',
|
|
data:{
|
|
datasets:[
|
|
{% if chrono_10c %}
|
|
{
|
|
label: '10 |',
|
|
backgroundColor: 'rgb(75, 192, 192, 0.25)',
|
|
borderColor: 'rgb(75, 192, 192)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_10c %}
|
|
{
|
|
x: '{{ chrono.date | date:"m/d/Y" }}',
|
|
y: '{{ chrono.score }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if chrono_r1 %}
|
|
{
|
|
label: 'L1',
|
|
backgroundColor: 'rgb(54, 162, 235, 0.25)',
|
|
borderColor: 'rgb(54, 162, 235)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_r1 %}
|
|
{
|
|
x: '{{ chrono.date | date:"m/d/Y" }}',
|
|
y: '{{ chrono.score }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if chrono_r2 %}
|
|
{
|
|
label: 'L2',
|
|
backgroundColor: 'rgb(153, 102, 255, 0.25)',
|
|
borderColor: 'rgb(153, 102, 255)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_r2 %}
|
|
{
|
|
x: '{{ chrono.date | date:"m/d/Y" }}',
|
|
y: '{{ chrono.score }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
|
|
{% if chrono_rf %}
|
|
{
|
|
label: 'L3',
|
|
backgroundColor: 'rgb(255, 205, 86, 0.25)',
|
|
borderColor: 'rgb(255, 205, 86)',
|
|
fill: true,
|
|
data: [
|
|
{% for chrono in chrono_rf %}
|
|
{
|
|
x: '{{ chrono.date | date:"m/d/Y" }}',
|
|
y: '{{ chrono.score }}'
|
|
},
|
|
{% endfor%}
|
|
]
|
|
},
|
|
{% endif %}
|
|
],
|
|
},
|
|
options: {
|
|
scales: {
|
|
xAxes: [{
|
|
type: "time",
|
|
time: {
|
|
format: 'MM/DD/YYYY',
|
|
round: 'day'
|
|
},
|
|
scaleLabel: {
|
|
display: true,
|
|
}
|
|
}, ],
|
|
yAxes: [{
|
|
scaleLabel: {
|
|
display: true,
|
|
}
|
|
}]
|
|
},
|
|
legend: {
|
|
display: true,
|
|
position: 'bottom',
|
|
}
|
|
},
|
|
});
|
|
</script>
|