Rev 1572 | Rev 1576 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1574 | jmachado | 1 | package pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors; |
1569 | jmachado | 2 | |
1571 | jmachado | 3 | import jomm.dao.impl.AbstractDao; |
4 | import org.apache.log4j.Logger; |
||
5 | import org.hibernate.Query; |
||
6 | import pt.estgp.estgweb.domain.OlapStarFactQuestionarioAnswer; |
||
1574 | jmachado | 7 | import pt.estgp.estgweb.services.jobs.ServiceJob; |
1571 | jmachado | 8 | import pt.estgp.estgweb.services.questionarios.PedagogicoAlunosProcessor; |
1574 | jmachado | 9 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.PerguntasGrupoQueryDao; |
10 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QueryDaoUtils; |
||
11 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QuestionariosQueryDao; |
||
12 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.reportsdomain.EntityEvaluated; |
||
13 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.reportsdomain.QuestionariosAlunosReport; |
||
14 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils.*; |
||
1571 | jmachado | 15 | import pt.estgp.estgweb.utils.ConfigProperties; |
16 | |||
17 | import java.awt.*; |
||
18 | import java.io.IOException; |
||
19 | import java.text.DecimalFormat; |
||
20 | import java.util.ArrayList; |
||
21 | import java.util.List; |
||
22 | |||
1569 | jmachado | 23 | /** |
24 | * Created by jorgemachado on 16/12/16. |
||
25 | */ |
||
1574 | jmachado | 26 | public abstract class ReportAlunosGenerator extends ServiceJob |
1569 | jmachado | 27 | { |
28 | |||
1574 | jmachado | 29 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(ReportAlunosGenerator.class); |
1571 | jmachado | 30 | |
1569 | jmachado | 31 | protected 1.5.0/docs/api/java/lang/String.html">String anoLectivo; |
32 | protected 1.5.0/docs/api/java/lang/String.html">String[] periodos; |
||
33 | protected 1.5.0/docs/api/java/lang/String.html">String[] degrees; |
||
34 | |||
1574 | jmachado | 35 | public ReportAlunosGenerator(1.5.0/docs/api/java/lang/String.html">String anoLectivo, 1.5.0/docs/api/java/lang/String.html">String[] periodos, 1.5.0/docs/api/java/lang/String.html">String[] degrees) { |
1569 | jmachado | 36 | this.anoLectivo = anoLectivo; |
37 | this.periodos = periodos; |
||
38 | this.degrees = degrees; |
||
39 | } |
||
1570 | jmachado | 40 | |
41 | |||
1571 | jmachado | 42 | /** |
43 | * Gera um gráfico com todas as respostas agregadas por questao para um professor |
||
44 | * @param codes |
||
45 | * @param anoLectivo |
||
46 | * @param report |
||
47 | */ |
||
48 | public static void criarGraficosRespostasAgregadas(1.5.0/docs/api/java/lang/String.html">String[] codes, |
||
49 | EntityEvaluated entityEvaluated, |
||
50 | 1.5.0/docs/api/java/lang/String.html">String anoLectivo, |
||
51 | QuestionariosAlunosReport report, |
||
52 | List<String> codigosCurso, |
||
53 | List<String> codigosEscola, |
||
54 | double tempoMinimo, |
||
55 | RespostasAgregadasGrupoStats.RespostasAgregadasChartTable respostasAgregadasChartTable, |
||
56 | RespostasAgregadasGrupoStats respostasAgregadasGrupo, |
||
57 | 1.5.0/docs/api/java/lang/String.html">String grupo, |
||
58 | 1.5.0/docs/api/java/lang/String.html">String subGrupo, |
||
59 | 1.5.0/docs/api/java/lang/String.html">String[] periodos, |
||
60 | 1.5.0/docs/api/java/lang/String.html">String[] degrees, |
||
61 | boolean generateChart) |
||
62 | { |
||
63 | 1.5.0/docs/api/java/lang/String.html">String periodosQuery = QueryDaoUtils.createPeriodosQuery(periodos, "quest", true); |
||
64 | 1.5.0/docs/api/java/lang/String.html">String degreesQuery = QueryDaoUtils.createDegreesQuery(degrees, "curso", true); |
||
65 | |||
66 | 1.5.0/docs/api/java/lang/String.html">String whereFragmentEntity = QuestionariosQueryDao.getWhereEntityCodesFragment(codes,entityEvaluated); |
||
67 | |||
68 | 1.5.0/docs/api/javax/management/Query.html">Query query;//*****CRIAR REPOSTAS DO GRUPO DOCENTE*****/// |
||
69 | |||
70 | |||
71 | query = AbstractDao.getCurrentSession().createQuery("" + |
||
72 | "SELECT " + |
||
73 | "avg(fc.intResposta) as media," + |
||
74 | "sum(case when fc.intResposta = 1 then 1 else 0 end) as r1," + |
||
75 | "sum(case when fc.intResposta = 2 then 1 else 0 end) as r2," + |
||
76 | "sum(case when fc.intResposta = 3 then 1 else 0 end) as r3," + |
||
77 | "sum(case when fc.intResposta = 4 then 1 else 0 end) as r4," + |
||
78 | "sum(case when fc.intResposta = 5 then 1 else 0 end) as r5," + |
||
79 | "std(fc.intResposta) as desvio," + |
||
80 | "count(fc.id) as total, " + |
||
81 | "prgp.pergunta as pergunta, " + |
||
82 | "prgp.numero as numero, " + |
||
83 | "avg(fc.tempoLevado) as tempoMedioLevado " + |
||
84 | |||
85 | "FROM " + OlapStarFactQuestionarioAnswer.class.getName() + " fc " + |
||
86 | "JOIN fc.olapPergunta prgp " + |
||
87 | "JOIN fc.olapTipologia tipo " + |
||
88 | "JOIN fc.olapQuestionario quest " + |
||
89 | "JOIN fc.olapCurso curso " + |
||
90 | "JOIN fc.olapTimeLine timeLine " + |
||
91 | |||
92 | "where " + |
||
93 | |||
94 | " quest.ano = :ano " + |
||
95 | whereFragmentEntity + |
||
96 | "and timeLine.nome = '" + PedagogicoAlunosProcessor.getHistoryDriveConstraintStatic() + "' " + |
||
97 | (tempoMinimo > 0 ? " and fc.tempoLevado > :tempoLevado " : "" ) + |
||
98 | periodosQuery + |
||
99 | degreesQuery + |
||
100 | (grupo == null ? "" : " and prgp.grupoCode = :grupoCode ") + |
||
101 | (subGrupo == null ? "" : " and prgp.subGrupoCode = :subGrupoCode ") + |
||
102 | "group by prgp.numero " + |
||
103 | "order by prgp.numero "); |
||
104 | if(grupo != null) |
||
105 | query.setString("grupoCode",grupo); |
||
106 | if(subGrupo != null) |
||
107 | query.setString("subGrupoCode",subGrupo); |
||
108 | // query.setString("codigoSiges",teacherCode); |
||
109 | query.setString("ano",anoLectivo); |
||
110 | if(tempoMinimo > 0) |
||
111 | { |
||
112 | query.setDouble("tempoLevado",tempoMinimo); |
||
113 | } |
||
114 | |||
115 | |||
116 | DataTable tableRespostasAgregadas = new DataTable(); |
||
117 | |||
118 | |||
119 | |||
120 | DataTable.Row header = tableRespostasAgregadas.addRowHeader(); |
||
121 | header.addColTextCenter("Questão"); |
||
122 | header.addColTextCenter("Resps."); |
||
123 | header.addColTextCenter("Tempo Médio de Resposta (seg.)"); |
||
124 | header.addColTextCenter("Nada Satisf. %"); |
||
125 | header.addColTextCenter("Pouco Satisf. %"); |
||
126 | header.addColTextCenter("Satisf. %"); |
||
127 | header.addColTextCenter("Bastante Satisf. %"); |
||
128 | header.addColTextCenter("Muito Satisf. %"); |
||
129 | header.addColTextCenter("Média"); |
||
130 | header.addColTextCenter("Desvio Padrão"); |
||
131 | |||
132 | if(entityEvaluated == EntityEvaluated.DOCENTE) |
||
133 | { |
||
134 | header.addColTextCenter("Média dos Cursos em que Lecciona"); |
||
135 | header.addColTextCenter("Diff Cursos"); |
||
136 | header.addColTextCenter("Média das Escolas em que Lecciona"); |
||
137 | header.addColTextCenter("Diff Escolas"); |
||
138 | } |
||
139 | else if(entityEvaluated == EntityEvaluated.CURSO) |
||
140 | { |
||
141 | header.addColTextCenter("Média da Escola"); |
||
142 | header.addColTextCenter("Diff Escola"); |
||
143 | } |
||
144 | else |
||
145 | { |
||
146 | throw new 1.5.0/docs/api/java/lang/RuntimeException.html">RuntimeException("Não implementado"); |
||
147 | } |
||
148 | |||
149 | |||
150 | |||
151 | List<Object[]> resultsTest = query.list(); |
||
152 | for(5+0%2Fdocs%2Fapi+Object">Object[] resultTest : resultsTest) |
||
153 | { |
||
154 | 1.5.0/docs/api/java/lang/Double.html">Double tempoMedioLevado = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[10]; |
||
155 | 1.5.0/docs/api/java/lang/Double.html">Double mediaDocente = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[0]; |
||
156 | 1.5.0/docs/api/java/lang/Double.html">Double desvio = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[6]; |
||
157 | 1.5.0/docs/api/java/lang/Long.html">Long total = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[7]; |
||
158 | double min = mediaDocente - (desvio*2); |
||
159 | double max = mediaDocente + (desvio*2); |
||
160 | if(max > 5) max = 5; |
||
161 | 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat df = new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#.##"); |
||
162 | |||
163 | 1.5.0/docs/api/java/lang/String.html">String questao = resultTest[8].toString(); |
||
164 | 1.5.0/docs/api/java/lang/String.html">String numero = resultTest[9].toString(); |
||
165 | |||
166 | |||
167 | DataTable.Row rowUnidade = tableRespostasAgregadas.addRowNormal(); |
||
168 | rowUnidade.addColLabelCenter(questao); |
||
169 | rowUnidade.addColTextCenter(""+total); |
||
170 | rowUnidade.addColTextCenter(df.format(tempoMedioLevado/1000.0)); |
||
171 | DataTable.Row.Col colResposta1 = rowUnidade.addColTextCenter(resultTest[1].toString()); |
||
172 | DataTable.Row.Col colResposta2 = rowUnidade.addColTextCenter(resultTest[2].toString()); |
||
173 | DataTable.Row.Col colResposta3 = rowUnidade.addColTextCenter(resultTest[3].toString()); |
||
174 | DataTable.Row.Col colResposta4 = rowUnidade.addColTextCenter(resultTest[4].toString()); |
||
175 | DataTable.Row.Col colResposta5 = rowUnidade.addColTextCenter(resultTest[5].toString()); |
||
176 | |||
177 | 1.5.0/docs/api/java/lang/Long.html">Long respostas1 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[1]; |
||
178 | 1.5.0/docs/api/java/lang/Long.html">Long respostas2 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[2]; |
||
179 | 1.5.0/docs/api/java/lang/Long.html">Long respostas3 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[3]; |
||
180 | 1.5.0/docs/api/java/lang/Long.html">Long respostas4 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[4]; |
||
181 | 1.5.0/docs/api/java/lang/Long.html">Long respostas5 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[5]; |
||
182 | |||
183 | if(respostas1 >= respostas2 && respostas1 >= respostas3 && respostas1 >= respostas4 && respostas1 >= respostas5) |
||
184 | { |
||
185 | colResposta1.setBackgroundColor(ChartBuilderUtil.COLOR_1_HEX); |
||
186 | }else if(respostas2 >= respostas1 && respostas2 >= respostas3 && respostas2 >= respostas4 && respostas2 >= respostas5) |
||
187 | { |
||
188 | colResposta2.setBackgroundColor(ChartBuilderUtil.COLOR_2_HEX); |
||
189 | }else if(respostas3 >= respostas1 && respostas3 >= respostas2 && respostas3 >= respostas4 && respostas3 >= respostas5) |
||
190 | { |
||
191 | colResposta3.setBackgroundColor(ChartBuilderUtil.COLOR_3_HEX); |
||
192 | }else if(respostas4 >= respostas1 && respostas4 >= respostas2 && respostas4 >= respostas3 && respostas4 >= respostas5) |
||
193 | { |
||
194 | colResposta4.setBackgroundColor(ChartBuilderUtil.COLOR_4_HEX); |
||
195 | }else if(respostas5 >= respostas1 && respostas5 >= respostas2 && respostas5 >= respostas3 && respostas5 >= respostas4) |
||
196 | { |
||
197 | colResposta5.setBackgroundColor(ChartBuilderUtil.COLOR_5_HEX); |
||
198 | } |
||
199 | |||
200 | |||
201 | |||
202 | |||
203 | |||
204 | double mediaCursos = QueryDaoUtils.getMediaCursos(codigosCurso, anoLectivo, numero, tempoMinimo, grupo,subGrupo, periodos, degrees); |
||
205 | double mediaEscolas = QueryDaoUtils.getMediaEscolas(codigosEscola, anoLectivo, numero, tempoMinimo, grupo,subGrupo, periodos, degrees); |
||
206 | |||
207 | |||
208 | |||
209 | try { |
||
210 | PerguntaStats perguntaStatsAndChart; |
||
211 | |||
212 | if(tempoMinimo <= 0 && generateChart) |
||
213 | { |
||
214 | List<String> info = new ArrayList<String>(); |
||
215 | info.add("Desvio Padrão: " + df.format(desvio)); |
||
216 | info.add("Média: " + df.format(mediaDocente)); |
||
217 | info.add("Respostas: " + total); |
||
218 | info.add("95% respostas entre: " + df.format(min) + " e " + df.format(max)); |
||
219 | perguntaStatsAndChart = ChartBuilderUtil.createChartRespostasPergunta(questao, info, |
||
220 | new int[]{ |
||
221 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[1]).intValue(), |
||
222 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[2]).intValue(), |
||
223 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[3]).intValue(), |
||
224 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[4]).intValue(), |
||
225 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[5]).intValue(), |
||
226 | }, "resposta" + tempoMinimo + numero, report.getQuestionariosReqRespondidos()); |
||
227 | |||
228 | } |
||
229 | else |
||
230 | perguntaStatsAndChart = new PerguntaStats(); |
||
231 | |||
232 | perguntaStatsAndChart.setPergunta(questao); |
||
233 | perguntaStatsAndChart.setNumero(numero); |
||
234 | perguntaStatsAndChart.setGrupo(grupo); |
||
235 | perguntaStatsAndChart.setSubGrupo(subGrupo); |
||
1572 | jmachado | 236 | perguntaStatsAndChart.setDesvio(df.format(desvio)); |
1571 | jmachado | 237 | perguntaStatsAndChart.setMediaCursosPrint(df.format(mediaCursos)); |
238 | perguntaStatsAndChart.setMediaEscolasPrint(df.format(mediaEscolas)); |
||
239 | perguntaStatsAndChart.setMediaCursos(mediaCursos); |
||
240 | perguntaStatsAndChart.setMediaEscolas(mediaEscolas); |
||
241 | perguntaStatsAndChart.setMediaEntidadeEmAvaliacao(mediaDocente); |
||
242 | perguntaStatsAndChart.setMediaEntidadeEmAvaliacaoPrint(df.format(mediaDocente)); |
||
243 | perguntaStatsAndChart.setPercentMediaCursos("" + ((int) ((mediaCursos / 5.0) * 100.0))); |
||
244 | perguntaStatsAndChart.setPercentMediaEscolas("" + ((int) ((mediaEscolas / 5.0) * 100.0))); |
||
245 | perguntaStatsAndChart.setPercentMediaEntidadeEmAvaliacao("" + ((int)((mediaDocente/5.0)*100.0))); |
||
246 | |||
247 | perguntaStatsAndChart.setDiffMediaCurso(mediaDocente - mediaCursos); |
||
248 | perguntaStatsAndChart.setDiffMediaEscola(mediaDocente - mediaEscolas); |
||
249 | perguntaStatsAndChart.setDiffMediaCursoPrint(df.format(mediaDocente - mediaCursos)); |
||
250 | perguntaStatsAndChart.setDiffMediaEscolaPrint(df.format(mediaDocente - mediaEscolas)); |
||
251 | |||
252 | rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaEntidadeEmAvaliacaoPrint(), perguntaStatsAndChart.getPercentMediaEntidadeEmAvaliacao(), true); |
||
253 | rowUnidade.addColTextCenter(df.format(desvio)); |
||
254 | if(entityEvaluated == EntityEvaluated.DOCENTE) |
||
255 | { |
||
256 | rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaCursosPrint(),perguntaStatsAndChart.getPercentMediaCursos(),true); |
||
257 | rowUnidade.addColNumberRight(perguntaStatsAndChart.getDiffMediaCursoPrint()).setBackgroundColor(ChartBuilderUtil.getBackgroundColorDiff(perguntaStatsAndChart.getDiffMediaCurso())); |
||
258 | } |
||
259 | else if(entityEvaluated == EntityEvaluated.CURSO) |
||
260 | { |
||
261 | |||
262 | } |
||
263 | else |
||
264 | { |
||
265 | throw new 1.5.0/docs/api/java/lang/RuntimeException.html">RuntimeException("Não implementado"); //para lembrar se implementar o de cima e esquecer este |
||
266 | } |
||
267 | rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaEscolasPrint(),perguntaStatsAndChart.getPercentMediaEscolas(),true); |
||
268 | rowUnidade.addColNumberRight(perguntaStatsAndChart.getDiffMediaEscolaPrint()).setBackgroundColor(ChartBuilderUtil.getBackgroundColorDiff(perguntaStatsAndChart.getDiffMediaEscola())); |
||
269 | |||
270 | respostasAgregadasChartTable.getRespostasAgregadasCharts().addChart(perguntaStatsAndChart); |
||
271 | respostasAgregadasChartTable.setRespostasTable(tableRespostasAgregadas); |
||
272 | |||
273 | if(tempoMinimo <= 0) |
||
274 | { |
||
275 | //adicionada segunda vez para ficar na classe de agregação de respostas e medias |
||
276 | //legadamente ja estavam no chart mas metem-se aqui tambem pois estavam em rows e afins |
||
277 | respostasAgregadasGrupo.getPerguntasStats().add(perguntaStatsAndChart); |
||
278 | PerguntasGrupoQueryDao.getMediasGrupo(codes,entityEvaluated, anoLectivo, report, codigosCurso, codigosEscola, grupo, subGrupo, respostasAgregadasGrupo.getMediasGrupo(), periodos, degrees); |
||
279 | } |
||
280 | |||
281 | } catch (1.5.0/docs/api/java/io/IOException.html">IOException e) { |
||
282 | logger.error(e,e); |
||
283 | } |
||
284 | } |
||
285 | |||
286 | |||
287 | } |
||
288 | |||
289 | |||
290 | protected 1.5.0/docs/api/java/lang/String.html">String criarChartETabelaMediaGruposPorUnidade(int width,int heightCategory,List<UnidadeStats> unidadesStats,1.5.0/docs/api/java/lang/String.html">String grupo1,1.5.0/docs/api/java/lang/String.html">String subgrupo1, 1.5.0/docs/api/java/lang/String.html">String grupo2,1.5.0/docs/api/java/lang/String.html">String subgrupo2,DataTable table,1.5.0/docs/api/java/lang/String.html">String tmpPathPrefix,1.5.0/docs/api/java/awt/Color.html">Color[] barColors,1.5.0/docs/api/java/awt/Color.html">Color[] labelsColors) throws 1.5.0/docs/api/java/io/IOException.html">IOException |
||
291 | { |
||
292 | //Se houver subgrupo usa-se a label do subgrupo |
||
293 | 1.5.0/docs/api/java/lang/String.html">String grupo1propertyIndex = subgrupo1 != null ? ConfigProperties.getProperty("questionario.group.inverse." + subgrupo1) : ConfigProperties.getProperty("questionario.group.inverse." + grupo1); |
||
294 | 1.5.0/docs/api/java/lang/String.html">String grupo1Label = ConfigProperties.getProperty("questionario.group" + grupo1propertyIndex + ".title"); |
||
295 | 1.5.0/docs/api/java/lang/String.html">String grupo2propertyIndex = subgrupo2 != null ? grupo2propertyIndex = ConfigProperties.getProperty("questionario.group.inverse." + subgrupo2) : ConfigProperties.getProperty("questionario.group.inverse." + grupo2); |
||
296 | 1.5.0/docs/api/java/lang/String.html">String grupo2Label = ConfigProperties.getProperty("questionario.group" + grupo2propertyIndex + ".title"); |
||
297 | |||
298 | if(table != null) |
||
299 | { |
||
300 | DataTable.Row headerDefinition = table.addRowHeader(); |
||
301 | headerDefinition.setInvisible(true); |
||
302 | headerDefinition.addColTextCenter("Unidade Inv").setWidth("20%"); |
||
303 | headerDefinition.addColTextCenter("Código Inv"); |
||
304 | headerDefinition.addColTextCenter("Curso Inv").setWidth("20%"); |
||
305 | headerDefinition.addColTextCenter("Código Curso Inv"); |
||
306 | headerDefinition.addColTextCenter("Respostas Inv"); |
||
307 | headerDefinition.addColTextCenter("Média Inv"); |
||
308 | headerDefinition.addColTextCenter("Desvio Inv"); |
||
309 | headerDefinition.addColTextCenter("Média Curso Inv"); |
||
310 | headerDefinition.addColTextCenter("Média Escola Inv"); |
||
311 | headerDefinition.addColTextCenter("Média Inv"); |
||
312 | headerDefinition.addColTextCenter("Desvio Inv"); |
||
313 | headerDefinition.addColTextCenter("Média Curso Inv"); |
||
314 | headerDefinition.addColTextCenter("Média Escola Inv"); |
||
315 | |||
316 | DataTable.Row header = table.addRowHeader(); |
||
317 | |||
318 | |||
319 | header.addColInvisible().setColspan(5); |
||
320 | DataTable.Row.Col colgrupo1 = header.addColTextCenter(grupo1Label); |
||
321 | DataTable.Row.Col colgrupo2 = header.addColTextCenter(grupo2Label); |
||
322 | colgrupo1.setColspan(4); |
||
323 | colgrupo2.setColspan(4); |
||
324 | |||
325 | colgrupo1.setBackgroundColor(ChartBuilderUtil.getRgbXslColor(barColors[0])); |
||
326 | colgrupo2.setBackgroundColor(ChartBuilderUtil.getRgbXslColor(barColors[1])); |
||
327 | |||
328 | DataTable.Row header2 = table.addRowHeader(); |
||
329 | header2.addColTextCenter("Unidade"); |
||
330 | header2.addColTextCenter("Código"); |
||
331 | header2.addColTextCenter("Curso"); |
||
332 | header2.addColTextCenter("Código Curso"); |
||
333 | header2.addColTextCenter("Resps"); |
||
334 | header2.addColTextCenter("Média").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
335 | header2.addColTextCenter("Desvio").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
336 | header2.addColTextCenter("Média Curso").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
337 | header2.addColTextCenter("Média Escola").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
338 | header2.addColTextCenter("Média").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
339 | header2.addColTextCenter("Desvio").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
340 | header2.addColTextCenter("Média Curso").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
341 | header2.addColTextCenter("Média Escola").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
342 | } |
||
343 | |||
344 | double valores[][] = new double[unidadesStats.size()][2]; |
||
345 | 1.5.0/docs/api/java/lang/String.html">String [] categories = new 1.5.0/docs/api/java/lang/String.html">String[unidadesStats.size()]; |
||
346 | int i = 0; |
||
347 | |||
348 | 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat df =new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#.##"); |
||
349 | for(UnidadeStats unidadeStats : unidadesStats) |
||
350 | { |
||
351 | UnidadeStats.UnidadeStatsGrupo unidadeStatsGrupo1 = unidadeStats.findUnidadeStatsGrupo(grupo1,subgrupo1); |
||
352 | UnidadeStats.UnidadeStatsGrupo unidadeStatsGrupo2 = unidadeStats.findUnidadeStatsGrupo(grupo2,subgrupo2); |
||
353 | valores[i][0] = unidadeStatsGrupo1.getMediasGrupo().getAvaliacaoMedia(); |
||
354 | valores[i][1] = unidadeStatsGrupo2.getMediasGrupo().getAvaliacaoMedia(); |
||
355 | categories[i] = unidadeStats.getNomeUnidadeComCursoAbreviado(); |
||
356 | i++; |
||
357 | |||
358 | if(table != null) |
||
359 | { |
||
360 | DataTable.Row rowUnit = table.addRowNormal(); |
||
361 | rowUnit.addColTextCenter(unidadeStats.getNomeUnidade()); |
||
362 | rowUnit.addColTextCenter(unidadeStats.getCodigoUnidade()); |
||
363 | rowUnit.addColTextCenter(unidadeStats.getNomeCurso()); |
||
364 | rowUnit.addColTextCenter(unidadeStats.getCodigoCurso()); |
||
365 | rowUnit.addColNumberRight("" + unidadeStats.getRespostas()); |
||
366 | |||
367 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getAvaliacaoMedia()), unidadeStatsGrupo1.getMediasGrupo().getPercentAvaliacaoMediaForTables(), true); |
||
368 | rowUnit.addColNumberRight(df.format(unidadeStatsGrupo1.getMediasGrupo().getDesvioPadrao())); |
||
369 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getMediaGlobalNosCursos()), unidadeStatsGrupo1.getMediasGrupo().getPercentMediaGlobalNosCursosForTables(), true); |
||
370 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getMediaGlobalNasEscolas()), unidadeStatsGrupo1.getMediasGrupo().getPercentMediaGlobalNasEscolasForTables(), true); |
||
371 | |||
372 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getAvaliacaoMedia()), unidadeStatsGrupo2.getMediasGrupo().getPercentAvaliacaoMediaForTables(), true); |
||
373 | rowUnit.addColNumberRight(df.format(unidadeStatsGrupo2.getMediasGrupo().getDesvioPadrao())); |
||
374 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getMediaGlobalNosCursos()), unidadeStatsGrupo2.getMediasGrupo().getPercentMediaGlobalNosCursosForTables(), true); |
||
375 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getMediaGlobalNasEscolas()), unidadeStatsGrupo2.getMediasGrupo().getPercentMediaGlobalNasEscolasForTables(), true); |
||
376 | } |
||
377 | |||
378 | } |
||
379 | |||
380 | 1.5.0/docs/api/java/lang/String.html">String path = ChartBuilderUtil.createBarChartBarsCategories( |
||
381 | new 1.5.0/docs/api/java/lang/String.html">String[]{grupo1Label,grupo2Label}, |
||
382 | categories, |
||
383 | barColors, |
||
384 | labelsColors, |
||
385 | valores, |
||
386 | 0,5, tmpPathPrefix + "unidadesConjuntas",width,heightCategory); |
||
387 | return path; |
||
388 | } |
||
1569 | jmachado | 389 | } |