Tracking: Fix graphics for reporting tool - refs BT#20908

pull/4963/head
Angel Fernando Quiroz Campos 2 years ago
parent 56ae3f994d
commit 82b62160d0
  1. 7
      assets/js/legacy/vendor.js
  2. 66
      public/main/template/default/tracking/tracking_course_log.html.twig

@ -19,7 +19,12 @@ global.hljs = hljs;
var textcomplete = require('textcomplete'); var textcomplete = require('textcomplete');
global.textcomplete = textcomplete; global.textcomplete = textcomplete;
require('chart.js'); //global.Chart = require("chart.js/dist/chart").Chart
import { Chart, registerables } from 'chart.js';
Chart.register(...registerables);
global.Chart = Chart;
require('./annotation.js'); require('./annotation.js');
require('../editor.js'); require('../editor.js');
import translateHtml from '../translatehtml.js'; import translateHtml from '../translatehtml.js';

@ -1,9 +1,9 @@
<!-- tracking course log --> <!-- tracking course log -->
<script> <script>
window.onload = function() { $(() => {
var scoreStudent = document.getElementById("chart-score").getContext('2d'); var scoreStudent = document.getElementById("chart-score").getContext('2d');
var lastAccess = document.getElementById("chart-access").getContext('2d'); var lastAccess = document.getElementById("chart-access").getContext('2d');
var jsonfile = {{ json_time_student }}; var jsonfile = {{ json_time_student|raw }};
var labels = []; var labels = [];
var times = []; var times = [];
@ -32,23 +32,23 @@ window.onload = function() {
display: false display: false
}, },
scales: { scales: {
xAxes:[{ x: {
position: "bottom", position: "bottom",
scaleLabel: { title: {
display: true, display: true,
labelString: '{{ "Students"|get_lang|e('js') }}', text: '{{ "Students"|get_lang|e('js') }}'
}, },
ticks: { ticks: { display: false },
display: false min: 0
} },
}], y: {
yAxes: [{ title: {
position: "left",
scaleLabel: {
display: true, display: true,
labelString: '{{ "Minutes"|get_lang|e('js') }}', text: '{{ "Minutes"|get_lang|e('js') }}'
},
position: "left",
min: 0
} }
}]
} }
} }
}); });
@ -59,9 +59,9 @@ window.onload = function() {
labels: ["0-9%", "10-19%", "20-29%", "30-39%", "40-49%", "50-59%", "60-69%", "70-79%", "80-89%", "90-100%"], labels: ["0-9%", "10-19%", "20-29%", "30-39%", "40-49%", "50-59%", "60-69%", "70-79%", "80-89%", "90-100%"],
datasets: [{ datasets: [{
label: '{{ "NumberOfUsers"|get_lang|e('js') }}', label: '{{ "NumberOfUsers"|get_lang|e('js') }}',
data: {{ score_distribution }}, data: {{ score_distribution|raw }},
backgroundColor: {{ chart_colors }}, backgroundColor: {{ chart_colors|raw }},
borderColor: {{ chart_colors }}, borderColor: {{ chart_colors|raw }},
borderWidth: 1, borderWidth: 1,
fill: false fill: false
}] }]
@ -71,35 +71,33 @@ window.onload = function() {
display: false display: false
}, },
scales: { scales: {
yAxes: [{ y: {
position: "left", position: "left",
scaleLabel: { title: {
display: true, text: '{{ "NumberOfUsers"|get_lang|e('js') }}',
labelString: '{{ "NumberOfUsers"|get_lang|e('js') }}', display: true
}, },
ticks: { ticks: {
display: true, display: true,
min: 0, min: 0,
stepSize: 1 stepSize: 1
}
}],
xAxes:[{
position: "bottom",
scaleLabel: {
display: true,
labelString: "{{ 'PercentileScoresDistribution'|get_lang|e('js') }}",
}, },
gridLines: { min: 0
},
x: {
position: "bottom",
title: {
text: "{{ 'PercentileScoresDistribution'|get_lang|e('js') }}",
display: true display: true
}, },
ticks: { gridLines: { display: true },
display: false, ticks: { display: true, },
} min: 0
}], },
} }
} }
}); });
}; })
</script> </script>
<div class="tracking-course-summary"> <div class="tracking-course-summary">

Loading…
Cancel
Save