Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nova data dashboard #89

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Dados das Alunas
  • Loading branch information
MariaSilvania committed Jul 15, 2018
commit 804a3954cfc38aef32384ff02f06c3885932e32f
4 changes: 2 additions & 2 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
.container{
display: flex;
flex-direction: column;
@@ -8,7 +8,7 @@
border: 1px solid black;
}
#piechart{
width: 400px;
width: 550px;
height: 300px;
}
body,
21 changes: 14 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
</head>
<body>
<div class="container">
<div class="row">
<!-- <div class="row">
<div class="col">
<div class="menu-container">
<ul class="menu clearfix">
@@ -43,15 +43,22 @@
</ul>
</div>
</div>
</div>
</div>-->

<div class="row">
<div class="col">
<h1>add texto</h1>
</div>
<div class="col">
<h1>add texto</h1>
</div>
<h1>Estudantes</h1>
<select id="drop-menu">
</select>
<div class="">
<div id="foto-Estudantes"></div>

</div>
<div id="conteudo-Estudantes"></div>

</div>
</div>

<div class="col">
<div id="piechart"></div>
</div>
78 changes: 65 additions & 13 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,77 @@
// Grafico alunas ativas e invativas
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);

var ativa = 0;
var inativa = 0;
for(var i = 0; i < 15; i++){
if(data.AQP["2016-2"].students[i].active == true){
ativa += 1;
}else{
inativa += 1;
}
var actives = [];
for(var i = 0; i < data.AQP["2016-2"].students.length; i++){
actives.push(data.AQP["2016-2"].students[i].active);
}

var countedActives = actives.reduce(function (allActives, active) {
if (active in allActives) {
allActives[active]++;
}
else {
allActives[active] = 1;
}
return allActives;
}, {});
console.log(countedActives);

function drawChart() {
var data = google.visualization.arrayToDataTable([
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['ativas', ativa],
['invativas', inativa]
]);
['Ativas', countedActives.true],
['Invativas', countedActives.false]
]);
var options = {
title: 'Turma 2016-2'
title: 'Alunas ativas e inativas',
titleTextStyle: {color: 'red', fontSize: 27},
colors:['#ffff33','#999966']
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}

//exibir Estudantes
var dropMenu = document.getElementById("drop-menu");
dropMenu.addEventListener("change", carregaEstudantes); //change é um evento

window.onload = carregaMenu();

function carregaMenu(){
var nome = document.createElement("option");
nome.innerHTML = "selecione sede";
nome.value = "none";
dropMenu.appendChild(nome);
for(sede in data){
var itemMenu = document.createElement("option");
itemMenu.value = sede;
itemMenu.innerHTML = sede;
dropMenu.appendChild(itemMenu);
}
};

function carregaEstudantes() {
var sede = dropMenu.value;
var listaEstudantes = document.getElementById("foto-Estudantes");
listaEstudantes.innerHTML = "";
for(turma in data[sede]){
for(i in data[sede][turma]["students"]){
var img = document.createElement("img");
var p = document.createElement("p");
img.src = data[sede]['2017-1']["students"][i]["photo"];
var name = data[sede]['2017-1']["students"][i]["name"];
var habTec = data[sede]['2017-1']["students"][i]["sprints"][i]["score"]["tech"];
var habHSE = data[sede]['2017-1']["students"][i]["sprints"][i]["score"]["hse"];

listaEstudantes.appendChild(img);
listaEstudantes.appendChild(p);

listaEstudantes.innerHTML += "<p><b>Nome: </b>" + name + "</p>";
listaEstudantes.innerHTML += "<p><b>Habilidades tech: </b>" + habTec + "</p>";
listaEstudantes.innerHTML += "<p><b>Habilidades HSE: </b>" + habHSE + "</p>";
}
}
};
// console.log(data[sede]['2017-1']["students"][i]["sprints"][i]["score"]["tech"]);