Commit c83ca7c8 authored by João Denis Rodrigues's avatar João Denis Rodrigues

Corrigido bug do stacked

parent cd39d164
Pipeline #10808 passed with stage
in 2 minutes and 55 seconds
......@@ -49,34 +49,6 @@ var colors = {
}
};
function setDataset(type, textLabel, stacked, yaxis, color) {
var dataset = {
type: type,
label: textLabel,
borderColor: color[0],
backgroundColor: color[1],
hoverBackgroundColor: color[0],
hoverBorderColor: color[0],
pointBorderColor: color[0],
pointBackgroundColor: color[0],
pointHoverBackgroundColor: color[0],
pointHoverBorderColor: color[0],
borderWidth: 3,
yAxisID: yaxis,
/* option: {
scales: {
xAxes: [{
stacked: stacked,
}],
yAxes: [{
stacked: stacked,
}]
}
}*/
}
return dataset;
}
function setTicks(beginAtZero, stepSize, suggestedMax, max, min, reverse) {
var ticks = {
beginAtZero: beginAtZero,
......@@ -293,13 +265,26 @@ function personalized_config(options, config) {
config.options.elements.line.fill = options['fill'];
break;
case 'stacked':
yAxes = config.options.scales.yAxes
/*yAxes = config.options.scales.yAxes
for (y in yAxes) {
yAxes[y].stacked = options['stacked'];
}*/
nok = Object.keys(options[object_key[key]]);
stacked = options['stacked'];
for (nk in nok) {
if (typeof config.options.scales[nok[nk]] == 'object') {
scales = config.options.scales[nok[nk]];
for (s in scales) {
scales[s].stacked = stacked[nok[nk]];
}
}
else {
config.options.scales[nok[nk]].stacked = stacked[nok[nk]];
}
}
break;
case 'yAxes':
config.options.scales.yAxes = {};
config.options.scales.yAxes = options['yAxes'];
break;
case 'yAxisID':
datasets = config.data.datasets;
......
......@@ -9,9 +9,11 @@ $(document).ready(function () {
labels: ["Quantidade Sem Evasão", "Quantidade Formandos", "Quantidade de Alunos"],
data: data,
options: {
stacked: false,
stacked: {
yAxes: false,
},
fill: false,
yAxes: [],
yAxes: {},
}
}
var ctx = document.getElementById("ira_semestral").getContext("2d");
......@@ -28,9 +30,11 @@ $(document).ready(function () {
labels: ['Taxas', "Quantidade Alunos"],
data: data,
options: {
stacked: false,
stacked: {
yAxes: false,
},
fill: false,
yAxes: [],
yAxes: {},
}
}
window.myevasao = build_line_chart(ctx, chart);
......
......@@ -14,7 +14,9 @@ function aprovacao_disciplina() {
data: data,
options: {
fill: false,
stacked: false,
stacked: {
yAxes: false,
},
yAxisID: ['y-axis-0', 'y-axis-1'],
displayGridlines: {
'y-axis-1': false,
......
......@@ -4,18 +4,6 @@ $('#lista_disciplinas').dataTable({
"aaSorting": [[ 1, "asc" ]] // Sort by first column descending
});
var color = [
['rgba(31, 110, 239, 1)', 'rgba(151,187,205, 0.2)'], //blue
['rgba(158, 22, 22, 1)', 'rgba(252, 22, 22, 0.1)'], //red
['rgba(112, 4, 244, 1)', 'rgba(112, 4, 244, 0.2)'], //purple
['rgba(157, 249, 234, 1)', 'rgba(157, 249, 234, 0.2)'], //light blue
['rgba(28, 188, 47, 1)', 'rgba(28, 188, 47, 0.2)'], //green
['rgba(232, 138, 16, 1)', 'rgba(232, 138, 16, 0.2)'], //orange
['rgba(229, 237, 7, 1)', 'rgba(229, 237, 7, 0.2)'], //yellow
['rgba(168, 163, 163, 1)', 'rgba(168, 163, 163, 0.2)'], //gray
];
function media_semestre() {
var data = $("#nota_media_semestre").data("data");
var new_data = [];
......@@ -67,56 +55,7 @@ function media_semestre() {
}
};
console.log(new_data);
/*
var result = {
values: [],
};
for (var item in data) {
title.push("Grade-"+item);
v = []
for (aux in data[item]) {
if (title.length == 1) {
labels.push(aux);
v.push(data[item][aux]);
}
else {
v.push(data[item][aux])
}
}
result.values.push(v);
}
labels[labels.length-1] = (parseInt(labels[labels.length-2]) + 1).toString();
for (i in labels) {
labels[i] = labels[i] + "º Periodo"
}
var media_semestre = {
datasets: []
}
for (t in title) {
media_semestre.datasets.push(setDataset("line", title[t], false, null, [color[t][0], color[t][1]]));
}
media_semestre.labels = labels;
for (v in result.values) {
media_semestre.datasets[v].data = result.values[v];
}
var ticks = setTicks(true, 10, 100, 100, 0);
var scales = {
xAxes: [configAxes(true, null, true, null, null, true, null, true)],
yAxes: [configAxes(false, 'linear', true, 'left', null, true, ticks, false),
configAxes(false, 'linear', false, 'left', null, true, ticks, false)
],
};
*/
var ctx = document.getElementById("nota_media_semestre").getContext("2d");
// window.myLine= new Chart(ctx, chartConfig('line', media_semestre, scales, true));*/
window.myLine = build_line_chart(ctx, config);
};
......
......@@ -25,6 +25,7 @@ $(document).ready(function () {
v.push(val);
new_data.push(v);
}
console.log(new_data);
config = {
labels: ['IRA'],
data: new_data,
......@@ -73,7 +74,9 @@ $(document).ready(function () {
'y-axis-1': false,
},
maxAll: true,
stacked: false,
stacked: {
yAxes: false,
},
}
}
......
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