Rev 1912 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1912 | Rev 1919 | ||
---|---|---|---|
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 | - | ||
45 | /** |
41 | /** |
46 | * |
42 | * |
47 | * @param results |
43 | * @param results |
48 | * @return the tmp path for generated chart |
44 | * @return the tmp path for generated chart |
49 | * @throws IOException |
45 | * @throws IOException |
Line 61... | Line 57... | ||
61 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1013Percent())),"Aprovados 10-13",""+temp.ano + "º Ano"); |
57 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1013Percent())),"Aprovados 10-13",""+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"); |
58 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1416Percent())),"Aprovados 14-16",""+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"); |
59 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double((int)(temp.getAprovados1720Percent())),"Aprovados 17-20",""+temp.ano + "º Ano"); |
64 | } |
60 | } |
65 | 61 | ||
- | 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 | ||
66 | 75 | ||
67 | JFreeChart chart = ChartFactory.createStackedBarChart(null,null,null,data, PlotOrientation.VERTICAL,true,false,false); |
76 | JFreeChart chart = ChartFactory.createStackedBarChart(null,null,null,data, PlotOrientation.VERTICAL,true,false,false); |
68 | 77 | ||
69 | CategoryPlot plot = chart.getCategoryPlot(); |
78 | CategoryPlot plot = chart.getCategoryPlot(); |
70 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
79 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
Line 98... | Line 107... | ||
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)); |
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)); |
99 | 108 | ||
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)); |
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)); |
101 | chart.getLegend().setFrame(BlockBorder.NONE); |
110 | chart.getLegend().setFrame(BlockBorder.NONE); |
102 | 111 | ||
- | 112 | ||
- | 113 | ||
103 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage(WIDTH, HEIGHT); |
114 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage( 300*4, 200*4); |
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; |
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; |
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); |
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); |
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)); |
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)); |
107 | 118 | ||
108 | FileUploaded fileUploaded = new FileUploaded(); |
119 | FileUploaded fileUploaded = new FileUploaded(); |
Line 110... | Line 121... | ||
110 | fileUploaded.setTitle("Taxa global de aproveitamento"); |
121 | fileUploaded.setTitle("Taxa global de aproveitamento"); |
111 | fileUploaded.setDescription("Curso: " + courseReportDocument.getCourseName() + " (" + courseReportDocument.getCourseCode()+ ") ano " + courseReportDocument.getYear()); |
122 | fileUploaded.setDescription("Curso: " + courseReportDocument.getCourseName() + " (" + courseReportDocument.getCourseCode()+ ") ano " + courseReportDocument.getYear()); |
112 | fileUploaded.setContentType(MimeTypeGuesser.getInstance().guessMimeType(output)); |
123 | fileUploaded.setContentType(MimeTypeGuesser.getInstance().guessMimeType(output)); |
113 | fileUploaded.setFileSize(output.length()); |
124 | fileUploaded.setFileSize(output.length()); |
114 | fileUploaded.setExtension("png"); |
125 | fileUploaded.setExtension("png"); |
115 | - | ||
116 | return fileUploaded; |
126 | return fileUploaded; |
117 | } |
127 | } |
118 | 128 | ||
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 { |
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 { |
120 | float aprovados = 10; |
130 | float aprovados = 10; |