Commit 94436e07 authored by João Denis Rodrigues's avatar João Denis Rodrigues

Gerador graficos aluno e curso corrigido

parent 0cd10bb5
Pipeline #10787 passed with stage
in 2 minutes and 30 seconds
......@@ -165,10 +165,10 @@ function calculate_max(values) {
});
}
else {
max_temp = round(max > max_temp ? max : max_temp);
max_temp = Math.ceil(max > max_temp ? max : max_temp)
max.push({
max: max_temp,
stepSize: max_temp / 10
stepSize: Math.ceil(max_temp / 10)
});
}
}
......@@ -318,15 +318,39 @@ function personalized_config(options, config) {
case 'yAxesDisplay':
yAxes = config.options.scales.yAxes;
new_object_key = Object.keys(options[object_key[key]]);
position = options['yAxesDisplay'];
display = options['yAxesDisplay'];
for (new_key in new_object_key) {
for (y in yAxes) {
if (yAxes[y].id == new_object_key[new_key]) {
yAxes[y].display = position[new_object_key[new_key]];
yAxes[y].display = display[new_object_key[new_key]];
}
}
}
break;
case 'yAxesPosition':
yAxes = config.options.scales.yAxes;
new_object_key = Object.keys(options[object_key[key]]);
position = options['yAxesPosition'];
for (new_key in new_object_key) {
for (y in yAxes) {
if (yAxes[y].id == new_object_key[new_key]) {
yAxes[y].position = position[new_object_key[new_key]];
}
}
}
break;
case 'maxAll':
yAxes = config.options.scales.yAxes;
maxAll = 0;
for (y in yAxes) {
if (yAxes[y].ticks.max > maxAll) {
maxAll = yAxes[y].ticks.max;
}
}
for (y in yAxes) {
yAxes[y].ticks.max = maxAll;
yAxes[y].ticks.suggestedMax = maxAll;
}
default:
// code
}
......@@ -342,7 +366,7 @@ function build_line_chart(ctx, chart, colors=['blue_alpha', 'cyan', 'purple', 'g
if (chart.hasOwnProperty("options")) {
personalized_config(chart.options, chart_config);
}
var chart = new Chart(ctx, chart_config);
return chart;
......@@ -353,19 +377,14 @@ function build_bar_chart(ctx, chart, colors=['blue_alpha', 'cyan']) {
var the_data = define_datasets(data, ['bar', 'bar'], chart.labels, colors);
var scales = define_scales(calculate_max(data.values));
var chart_config = chartConfig('bar', the_data, scales, false);
if (chart.hasOwnProperty("options")) {
personalized_config(chart.options, chart_config);
}
/* chart_config.options.scales.yAxes[0].display = false;
chart_config.options.scales.yAxes[0].gridLines.display = false;
chart_config.options.scales.yAxes[0].ticks.display = false;*/
chart_config.options.scales.yAxes[0].stacked = false;
// chart_config.options.scales.yAxes[1].position = 'left';
var chart = new Chart(ctx, chart_config);
return chart_config;
return chart;
}
function build_line_bar_chart(ctx, chart, colors=['orange', 'blue_alpha']) {
......
......@@ -5,7 +5,6 @@ $(document).ready(function () {
return;
var data = $("#ira_semestral").data("data");
var chart = {
labels: ["Quantidade Sem Evasão", "Quantidade Formandos", "Quantidade de Alunos"],
data: data,
......
......@@ -19,25 +19,24 @@ $(document).ready(function () {
}
var aprovacao_semestral = function () {
if($("#aprovacao_semestral").length == 0)
return;
var data = $("#aprovacao_semestral").data("data");
var ctx = document.getElementById("aprovacao_semestral").getContext("2d");
var chart = {
labels: ['Disciplinas Aprovado', 'Quantidade Disciplinas'],
data: data,
options: {
stacked: false,
yAxisID: ['y-axis-0', 'y-axis-1'],
//displayAxes: {
yAxesDisplay: {
'y-axis-1': false,
}
}
}
window.myTwoBar = build_bar_chart(ctx, chart, ['blue', 'red']);
var data = $("#aprovacao_semestral").data("data");
var ctx = document.getElementById("aprovacao_semestral").getContext("2d");
var chart = {
labels: ['Disciplinas Aprovado', 'Quantidade Disciplinas'],
data: data,
options: {
yAxisID: ['y-axis-0', 'y-axis-1'],
yAxesDisplay: {
'y-axis-0': false,
},
maxAll: true,
yAxesPosition: {
'y-axis-1': 'left',
}
}
}
window.myTwoBar = build_bar_chart(ctx, chart, ['blue', 'red']);
}
var posicao_turma_ingresso_semestral = function () {
......@@ -80,7 +79,6 @@ $(document).ready(function () {
window.myLineBar = build_line_bar_chart(ctx, chart);
}
ira_semestral();
aprovacao_semestral();
posicao_turma_ingresso_semestral();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment