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