Rev 1914 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1914 | Rev 1934 | ||
---|---|---|---|
1 | package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
1 | package pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components; |
2 | 2 | ||
3 | import jomm.dao.impl.AbstractDao; |
3 | import jomm.dao.impl.AbstractDao; |
4 | import jomm.utils.BytesUtils; |
4 | import jomm.utils.BytesUtils; |
5 | import jomm.utils.MimeTypeGuesser; |
5 | import jomm.utils.MimeTypeGuesser; |
6 | import jomm.utils.StreamsUtils; |
6 | import jomm.utils.StreamsUtils; |
7 | import org.jfree.chart.ChartFactory; |
7 | import org.jfree.chart.ChartFactory; |
8 | import org.jfree.chart.JFreeChart; |
8 | import org.jfree.chart.JFreeChart; |
9 | import org.jfree.chart.axis.CategoryAxis; |
9 | import org.jfree.chart.axis.CategoryAxis; |
10 | import org.jfree.chart.axis.NumberAxis; |
10 | import org.jfree.chart.axis.NumberAxis; |
11 | import org.jfree.chart.block.BlockBorder; |
11 | import org.jfree.chart.block.BlockBorder; |
12 | import org.jfree.chart.labels.ItemLabelAnchor; |
12 | import org.jfree.chart.labels.ItemLabelAnchor; |
13 | import org.jfree.chart.labels.ItemLabelPosition; |
13 | import org.jfree.chart.labels.ItemLabelPosition; |
14 | import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; |
14 | import org.jfree.chart.labels.StandardCategoryItemLabelGenerator; |
15 | import org.jfree.chart.plot.CategoryPlot; |
15 | import org.jfree.chart.plot.CategoryPlot; |
16 | import org.jfree.chart.plot.PiePlot; |
16 | import org.jfree.chart.plot.PiePlot; |
17 | import org.jfree.chart.plot.PlotOrientation; |
17 | import org.jfree.chart.plot.PlotOrientation; |
18 | import org.jfree.chart.plot.RingPlot; |
18 | import org.jfree.chart.plot.RingPlot; |
19 | import org.jfree.chart.renderer.category.StackedBarRenderer; |
19 | import org.jfree.chart.renderer.category.StackedBarRenderer; |
20 | import org.jfree.chart.renderer.category.StandardBarPainter; |
20 | import org.jfree.chart.renderer.category.StandardBarPainter; |
21 | import org.jfree.chart.title.LegendTitle; |
21 | import org.jfree.chart.title.LegendTitle; |
22 | import org.jfree.data.category.DefaultCategoryDataset; |
22 | import org.jfree.data.category.DefaultCategoryDataset; |
23 | import org.jfree.data.general.DefaultPieDataset; |
23 | import org.jfree.data.general.DefaultPieDataset; |
24 | import org.jfree.ui.RectangleInsets; |
24 | import org.jfree.ui.RectangleInsets; |
25 | import org.jfree.ui.TextAnchor; |
25 | import org.jfree.ui.TextAnchor; |
26 | import org.json.JSONException; |
26 | import org.json.JSONException; |
27 | import org.json.JSONObject; |
27 | import org.json.JSONObject; |
28 | import pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument; |
28 | import pt.estgp.estgweb.services.courses.coursereport.documentmodel.CourseReportDocument; |
29 | import pt.estgp.estgweb.services.questionarios.QuestionariosReportsService; |
29 | import pt.estgp.estgweb.services.questionarios.QuestionariosReportsService; |
30 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils.DataTable; |
30 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils.DataTable; |
31 | import pt.estgp.estgweb.utils.Globals; |
31 | import pt.estgp.estgweb.utils.Globals; |
32 | import pt.estgp.estgweb.utils.documentBuilder.ImageComponent; |
32 | import pt.estgp.estgweb.utils.documentBuilder.ImageComponent; |
33 | import pt.estgp.estgweb.web.controllers.utils.FileUploaded; |
33 | import pt.estgp.estgweb.web.controllers.utils.FileUploaded; |
34 | 34 | ||
35 | import javax.imageio.ImageIO; |
35 | import javax.imageio.ImageIO; |
36 | import java.awt.*; |
36 | import java.awt.*; |
37 | import java.awt.image.BufferedImage; |
37 | import java.awt.image.BufferedImage; |
38 | import java.io.FileNotFoundException; |
38 | import java.io.FileNotFoundException; |
39 | import java.io.FileOutputStream; |
39 | import java.io.FileOutputStream; |
40 | import java.io.IOException; |
40 | import java.io.IOException; |
41 | import java.io.InputStream; |
41 | import java.io.InputStream; |
42 | import java.net.URL; |
42 | import java.net.URL; |
43 | import java.net.URLConnection; |
43 | import java.net.URLConnection; |
44 | import java.text.DecimalFormat; |
44 | import java.text.DecimalFormat; |
45 | import java.text.NumberFormat; |
45 | import java.text.NumberFormat; |
46 | import java.util.List; |
46 | import java.util.List; |
47 | 47 | ||
48 | /** |
48 | /** |
49 | * Created by danielmarmelo on 30/11/17. |
49 | * Created by danielmarmelo on 30/11/17. |
50 | */ |
50 | */ |
51 | public class GlobalLearningResultsChartYearImg extends ImageComponent |
51 | public class GlobalLearningResultsChartYearImg extends ImageComponent |
52 | { |
52 | { |
- | 53 | public GlobalLearningResultsChartYearImg() { |
|
- | 54 | setWidth(200); |
|
- | 55 | setHeight(200); |
|
- | 56 | } |
|
- | 57 | ||
53 | public FileUploaded generateChart2tmp(UnitsLearningResultsTable results, CourseReportDocument courseReportDocument) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
58 | public FileUploaded generateChart2tmp(UnitsLearningResultsTable results, CourseReportDocument courseReportDocument) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
54 | List<UnitsLearningResultYear> years = results.getYears(); |
59 | List<UnitsLearningResultYear> years = results.getYears(); |
55 | 60 | ||
56 | 1.5.0/docs/api/java/lang/String.html">String tempName = BytesUtils.generateHexKey() + ".png"; |
61 | 1.5.0/docs/api/java/lang/String.html">String tempName = BytesUtils.generateHexKey() + ".png"; |
57 | 62 | ||
58 | DefaultCategoryDataset data = new DefaultCategoryDataset(); |
63 | DefaultCategoryDataset data = new DefaultCategoryDataset(); |
59 | for (UnitsLearningResultYear year : years) { |
64 | for (UnitsLearningResultYear year : years) { |
60 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(year.getAprovados1013Percent()), "Aprovados 10-13", year.getAno() + "º Ano"); |
65 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(year.getAprovados1013Percent()), "Aprovados 10-13", year.getAno() + "º Ano"); |
61 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(year.getAprovados1416Percent()), "Aprovados 14-16", year.getAno() + "º Ano"); |
66 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(year.getAprovados1416Percent()), "Aprovados 14-16", year.getAno() + "º Ano"); |
62 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(year.getAprovados1720Percent()), "Aprovados 17-20", year.getAno() + "º Ano"); |
67 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(year.getAprovados1720Percent()), "Aprovados 17-20", year.getAno() + "º Ano"); |
63 | } |
68 | } |
64 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(results.getAprovados1013Percent()), "Aprovados 10-13", "Total"); |
69 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(results.getAprovados1013Percent()), "Aprovados 10-13", "Total"); |
65 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(results.getAprovados1416Percent()), "Aprovados 14-16", "Total"); |
70 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(results.getAprovados1416Percent()), "Aprovados 14-16", "Total"); |
66 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(results.getAprovados1720Percent()), "Aprovados 17-20", "Total"); |
71 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(results.getAprovados1720Percent()), "Aprovados 17-20", "Total"); |
67 | 72 | ||
68 | JFreeChart chart = ChartFactory.createStackedBarChart( |
73 | JFreeChart chart = ChartFactory.createStackedBarChart( |
69 | null, |
74 | null, |
70 | null, |
75 | null, |
71 | null, |
76 | null, |
72 | data, |
77 | data, |
73 | PlotOrientation.VERTICAL, |
78 | PlotOrientation.VERTICAL, |
74 | true, |
79 | true, |
75 | false, |
80 | false, |
76 | false); |
81 | false); |
77 | 82 | ||
78 | chart.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
83 | chart.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
79 | CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
84 | CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
80 | plot.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
85 | plot.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
81 | plot.setRangeGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.GRAY); |
86 | plot.setRangeGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.GRAY); |
82 | plot.setRangeGridlinesVisible(true); |
87 | plot.setRangeGridlinesVisible(true); |
83 | //plot.setRangeGridlineStroke(new BasicStroke(1.0f)); |
88 | //plot.setRangeGridlineStroke(new BasicStroke(1.0f)); |
84 | 89 | ||
85 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
90 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
86 | chart.setPadding(chartRectangle); |
91 | chart.setPadding(chartRectangle); |
87 | 92 | ||
88 | plot.getDomainAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
93 | plot.getDomainAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
89 | plot.getRangeAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
94 | plot.getRangeAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
90 | 95 | ||
91 | StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); |
96 | StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); |
92 | // Remover gradiente das barras |
97 | // Remover gradiente das barras |
93 | renderer.setBarPainter(new StandardBarPainter()); |
98 | renderer.setBarPainter(new StandardBarPainter()); |
94 | renderer.setSeriesPaint(0, new 1.5.0/docs/api/java/awt/Color.html">Color(237,127,32)); |
99 | renderer.setSeriesPaint(0, new 1.5.0/docs/api/java/awt/Color.html">Color(237,127,32)); |
95 | renderer.setSeriesPaint(1, new 1.5.0/docs/api/java/awt/Color.html">Color(255,198,0)); |
100 | renderer.setSeriesPaint(1, new 1.5.0/docs/api/java/awt/Color.html">Color(255,198,0)); |
96 | renderer.setSeriesPaint(2, new 1.5.0/docs/api/java/awt/Color.html">Color(122,173,38)); |
101 | renderer.setSeriesPaint(2, new 1.5.0/docs/api/java/awt/Color.html">Color(122,173,38)); |
97 | renderer.setMaximumBarWidth(0.2); |
102 | renderer.setMaximumBarWidth(0.2); |
98 | 103 | ||
99 | renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#.##'%'"))); |
104 | renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#.##'%'"))); |
100 | renderer.setBaseItemLabelsVisible(true); |
105 | renderer.setBaseItemLabelsVisible(true); |
101 | 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,25)); |
106 | 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,25)); |
102 | 107 | ||
103 | LegendTitle legend = chart.getLegend(); |
108 | LegendTitle legend = chart.getLegend(); |
104 | legend.setItemFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,25)); |
109 | legend.setItemFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,25)); |
105 | legend.setFrame(BlockBorder.NONE); |
110 | legend.setFrame(BlockBorder.NONE); |
106 | 111 | ||
107 | 112 | ||
108 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage( 300*4, 200*4); |
113 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage( 300*4, 200*4); |
109 | 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; |
114 | 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; |
110 | 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); |
115 | 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); |
111 | 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)); |
116 | 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)); |
112 | 117 | ||
113 | FileUploaded fileUploaded = new FileUploaded(); |
118 | FileUploaded fileUploaded = new FileUploaded(); |
114 | fileUploaded.setTmpName(tempName); |
119 | fileUploaded.setTmpName(tempName); |
115 | fileUploaded.setTitle("Taxa global de aproveitamento"); |
120 | fileUploaded.setTitle("Taxa global de aproveitamento"); |
116 | fileUploaded.setDescription("Curso: " + courseReportDocument.getCourseName() + " (" + courseReportDocument.getCourseCode()+ ") ano " + courseReportDocument.getYear()); |
121 | fileUploaded.setDescription("Curso: " + courseReportDocument.getCourseName() + " (" + courseReportDocument.getCourseCode()+ ") ano " + courseReportDocument.getYear()); |
117 | fileUploaded.setContentType(MimeTypeGuesser.getInstance().guessMimeType(output)); |
122 | fileUploaded.setContentType(MimeTypeGuesser.getInstance().guessMimeType(output)); |
118 | fileUploaded.setFileSize(output.length()); |
123 | fileUploaded.setFileSize(output.length()); |
119 | fileUploaded.setExtension("png"); |
124 | fileUploaded.setExtension("png"); |
120 | 125 | ||
121 | return fileUploaded; |
126 | return fileUploaded; |
122 | } |
127 | } |
123 | 128 | ||
124 | 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 { |
125 | 1.5.0/docs/api/java/lang/String.html">String tempName = "test.png"; |
130 | 1.5.0/docs/api/java/lang/String.html">String tempName = "test.png"; |
126 | 131 | ||
127 | DefaultCategoryDataset data = new DefaultCategoryDataset(); |
132 | DefaultCategoryDataset data = new DefaultCategoryDataset(); |
128 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(29.5), "Aprovados 10-13", "1º Ano"); |
133 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(29.5), "Aprovados 10-13", "1º Ano"); |
129 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(50.5), "Aprovados 14-16", "1º Ano"); |
134 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(50.5), "Aprovados 14-16", "1º Ano"); |
130 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(20), "Aprovados 17-20", "1º Ano"); |
135 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(20), "Aprovados 17-20", "1º Ano"); |
131 | 136 | ||
132 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(10), "Aprovados 10-13", "2º Ano"); |
137 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(10), "Aprovados 10-13", "2º Ano"); |
133 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(40), "Aprovados 14-16", "2º Ano"); |
138 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(40), "Aprovados 14-16", "2º Ano"); |
134 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(50), "Aprovados 17-20", "2º Ano"); |
139 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(50), "Aprovados 17-20", "2º Ano"); |
135 | 140 | ||
136 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(50), "Aprovados 10-13", "3º Ano"); |
141 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(50), "Aprovados 10-13", "3º Ano"); |
137 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(10), "Aprovados 14-16", "3º Ano"); |
142 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(10), "Aprovados 14-16", "3º Ano"); |
138 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(40), "Aprovados 17-20", "3º Ano"); |
143 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(40), "Aprovados 17-20", "3º Ano"); |
139 | 144 | ||
140 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(33.33), "Aprovados 10-13", "Total"); |
145 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(33.33), "Aprovados 10-13", "Total"); |
141 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(33.33), "Aprovados 14-16", "Total"); |
146 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(33.33), "Aprovados 14-16", "Total"); |
142 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(33.33), "Aprovados 17-20", "Total"); |
147 | data.addValue(new 1.5.0/docs/api/java/lang/Double.html">Double(33.33), "Aprovados 17-20", "Total"); |
143 | 148 | ||
144 | 149 | ||
145 | 150 | ||
146 | JFreeChart chart = ChartFactory.createStackedBarChart( |
151 | JFreeChart chart = ChartFactory.createStackedBarChart( |
147 | null, |
152 | null, |
148 | null, |
153 | null, |
149 | null, |
154 | null, |
150 | data, |
155 | data, |
151 | PlotOrientation.VERTICAL, |
156 | PlotOrientation.VERTICAL, |
152 | true, |
157 | true, |
153 | false, |
158 | false, |
154 | false); |
159 | false); |
155 | 160 | ||
156 | chart.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
161 | chart.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
157 | CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
162 | CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
158 | plot.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
163 | plot.setBackgroundPaint(1.5.0/docs/api/java/awt/Color.html">Color.WHITE); |
159 | plot.setRangeGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.GRAY); |
164 | plot.setRangeGridlinePaint(1.5.0/docs/api/java/awt/Color.html">Color.GRAY); |
160 | plot.setRangeGridlinesVisible(true); |
165 | plot.setRangeGridlinesVisible(true); |
161 | //plot.setRangeGridlineStroke(new BasicStroke(1.0f)); |
166 | //plot.setRangeGridlineStroke(new BasicStroke(1.0f)); |
162 | 167 | ||
163 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
168 | RectangleInsets chartRectangle = new RectangleInsets(0,0,30F,0); |
164 | chart.setPadding(chartRectangle); |
169 | chart.setPadding(chartRectangle); |
165 | 170 | ||
166 | plot.getDomainAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
171 | plot.getDomainAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
167 | plot.getRangeAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
172 | plot.getRangeAxis().setTickLabelFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN, 25)); |
168 | 173 | ||
169 | StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); |
174 | StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); |
170 | // Remover gradiente das barras |
175 | // Remover gradiente das barras |
171 | renderer.setBarPainter(new StandardBarPainter()); |
176 | renderer.setBarPainter(new StandardBarPainter()); |
172 | renderer.setSeriesPaint(0, new 1.5.0/docs/api/java/awt/Color.html">Color(237,127,32)); |
177 | renderer.setSeriesPaint(0, new 1.5.0/docs/api/java/awt/Color.html">Color(237,127,32)); |
173 | renderer.setSeriesPaint(1, new 1.5.0/docs/api/java/awt/Color.html">Color(255,198,0)); |
178 | renderer.setSeriesPaint(1, new 1.5.0/docs/api/java/awt/Color.html">Color(255,198,0)); |
174 | renderer.setSeriesPaint(2, new 1.5.0/docs/api/java/awt/Color.html">Color(122,173,38)); |
179 | renderer.setSeriesPaint(2, new 1.5.0/docs/api/java/awt/Color.html">Color(122,173,38)); |
175 | renderer.setMaximumBarWidth(0.2); |
180 | renderer.setMaximumBarWidth(0.2); |
176 | 181 | ||
177 | renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#.##'%'"))); |
182 | renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#.##'%'"))); |
178 | renderer.setBaseItemLabelsVisible(true); |
183 | renderer.setBaseItemLabelsVisible(true); |
179 | 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,25)); |
184 | 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,25)); |
180 | 185 | ||
181 | LegendTitle legend = chart.getLegend(); |
186 | LegendTitle legend = chart.getLegend(); |
182 | legend.setItemFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,25)); |
187 | legend.setItemFont(new 1.5.0/docs/api/java/awt/Font.html">Font("Helvetica", 1.5.0/docs/api/java/awt/Font.html">Font.PLAIN,25)); |
183 | legend.setFrame(BlockBorder.NONE); |
188 | legend.setFrame(BlockBorder.NONE); |
184 | 189 | ||
185 | 190 | ||
186 | 191 | ||
187 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage( 300*4, 200*4); |
192 | 1.5.0/docs/api/java/awt/image/BufferedImage.html">BufferedImage image = chart.createBufferedImage( 300*4, 200*4); |
188 | 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; |
193 | 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; |
189 | 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); |
194 | 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); |
190 | 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)); |
195 | 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)); |
191 | } |
196 | } |
192 | } |
197 | } |
193 | 198 |