Rev 1909 | Rev 1919 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1909 | Rev 1912 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | /** |
36 | /** |
37 | * Created by jorgemachado on 31/10/17. |
37 | * Created by jorgemachado on 31/10/17. |
38 | */ |
38 | */ |
39 | public class GlobalLearningResultsChartYearImg extends ImageComponent |
39 | public class GlobalLearningResultsChartYearImg extends ImageComponent |
40 | { |
40 | { |
- | 41 | ||
- | 42 | public static final int WIDTH = 300 * 4; |
|
- | 43 | public static final int HEIGHT = 200 * 4; |
|
- | 44 | ||
41 | /** |
45 | /** |
42 | * |
46 | * |
43 | * @param results |
47 | * @param results |
44 | * @return the tmp path for generated chart |
48 | * @return the tmp path for generated chart |
45 | * @throws IOException |
49 | * @throws IOException |
Line 57... | Line 61... | ||
57 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1013Percent())),"Aprovados 10-13",""+temp.ano + "º Ano"); |
61 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1013Percent())),"Aprovados 10-13",""+temp.ano + "º Ano"); |
58 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1416Percent())),"Aprovados 14-16",""+temp.ano + "º Ano"); |
62 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1416Percent())),"Aprovados 14-16",""+temp.ano + "º Ano"); |
59 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1720Percent())),"Aprovados 17-20",""+temp.ano + "º Ano"); |
63 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1720Percent())),"Aprovados 17-20",""+temp.ano + "º Ano"); |
60 | } |
64 | } |
61 | 65 | ||
62 | for(UnitsLearningResultYear temp: unitsLearningResultYearList) { |
- | |
63 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1013Percent())),"Aprovados 10-13","2º Ano"); |
- | |
64 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1416Percent())),"Aprovados 14-16","2º Ano"); |
- | |
65 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1720Percent())),"Aprovados 17-20","2º Ano"); |
- | |
66 | } |
- | |
67 | - | ||
68 | for(UnitsLearningResultYear temp: unitsLearningResultYearList) { |
- | |
69 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1013Percent())),"Aprovados 10-13","3º Ano"); |
- | |
70 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1416Percent())),"Aprovados 14-16","3º Ano"); |
- | |
71 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(32),"Aprovados 17-20","3º Ano"); |
- | |
72 | } |
- | |
73 | - | ||
74 | - | ||
75 | 66 | ||
76 | JFreeChart chart = ChartFactory.createStackedBarChart(null,null,null,data, PlotOrientation.VERTICAL,true,false,false); |
67 | JFreeChart chart = ChartFactory.createStackedBarChart(null,null,null,data, PlotOrientation.VERTICAL,true,false,false); |
77 | 68 | ||
78 | CategoryPlot plot = chart.getCategoryPlot(); |
69 | CategoryPlot plot = chart.getCategoryPlot(); |
79 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
70 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
Line 107... | Line 98... | ||
107 | renderer.setBaseItemLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica",1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,30)); |
98 | renderer.setBaseItemLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica",1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,30)); |
108 | 99 | ||
109 | chart.getLegend().setItemFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,30)); |
100 | chart.getLegend().setItemFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,30)); |
110 | chart.getLegend().setFrame(BlockBorder.NONE); |
101 | chart.getLegend().setFrame(BlockBorder.NONE); |
111 | 102 | ||
112 | - | ||
113 | - | ||
114 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage( 300*4, 200*4); |
103 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage(WIDTH, HEIGHT); |
115 | 1.5.0/docs/api/java/lang/String.html">String pathGraficoTiposAlunos = Globals.TMP_DIR + java.io.1.5.0/docs/api/java/io/File.html">File.separator + tempName; |
104 | 1.5.0/docs/api/java/lang/String.html">String pathGraficoTiposAlunos = Globals.TMP_DIR + java.io.1.5.0/docs/api/java/io/File.html">File.separator + tempName; |
116 | java.io.1.5.0/docs/api/java/io/File.html">File output = new java.io.1.5.0/docs/api/java/io/File.html">File(pathGraficoTiposAlunos); |
105 | java.io.1.5.0/docs/api/java/io/File.html">File output = new java.io.1.5.0/docs/api/java/io/File.html">File(pathGraficoTiposAlunos); |
117 | 1.5.0/docs/api/javax/imageio/ImageIO.html">ImageIO.write(image, "png", new 1.5.0/docs/api/java/io/FileOutputStream.html">FileOutputStream(output)); |
106 | 1.5.0/docs/api/javax/imageio/ImageIO.html">ImageIO.write(image, "png", new 1.5.0/docs/api/java/io/FileOutputStream.html">FileOutputStream(output)); |
118 | 107 | ||
119 | FileUploaded fileUploaded = new FileUploaded(); |
108 | FileUploaded fileUploaded = new FileUploaded(); |
Line 121... | Line 110... | ||
121 | fileUploaded.setTitle("Taxa global de aproveitamento"); |
110 | fileUploaded.setTitle("Taxa global de aproveitamento"); |
122 | fileUploaded.setDescription("Curso: " + courseReportDocument.getCourseName() + " (" + courseReportDocument.getCourseCode()+ ") ano " + courseReportDocument.getYear()); |
111 | fileUploaded.setDescription("Curso: " + courseReportDocument.getCourseName() + " (" + courseReportDocument.getCourseCode()+ ") ano " + courseReportDocument.getYear()); |
123 | fileUploaded.setContentType(MimeTypeGuesser.getInstance().guessMimeType(output)); |
112 | fileUploaded.setContentType(MimeTypeGuesser.getInstance().guessMimeType(output)); |
124 | fileUploaded.setFileSize(output.length()); |
113 | fileUploaded.setFileSize(output.length()); |
125 | fileUploaded.setExtension("png"); |
114 | fileUploaded.setExtension("png"); |
- | 115 | ||
126 | return fileUploaded; |
116 | return fileUploaded; |
127 | } |
117 | } |
128 | 118 | ||
129 | public static void main(1.5.0/docs/api/java/lang/String.html">String [] args) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
119 | public static void main(1.5.0/docs/api/java/lang/String.html">String [] args) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
130 | float aprovados = 10; |
120 | float aprovados = 10; |