Rev 261 | Rev 264 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 261 | Rev 263 | ||
|---|---|---|---|
| Line 2... | Line 2... | ||
| 2 | 2 | ||
| 3 | import java.util.ArrayList; |
3 | import java.util.ArrayList; |
| 4 | import java.util.Arrays; |
- | |
| 5 | import java.util.Calendar; |
4 | import java.util.Calendar; |
| 6 | import java.util.List; |
5 | import java.util.List; |
| 7 | 6 | ||
| 8 | import org.primefaces.model.charts.ChartData; |
7 | import org.primefaces.model.charts.ChartData; |
| 9 | import org.primefaces.model.charts.axes.cartesian.CartesianScales; |
8 | import org.primefaces.model.charts.axes.cartesian.CartesianScales; |
| Line 14... | Line 13... | ||
| 14 | import org.primefaces.model.charts.bar.BarChartOptions; |
13 | import org.primefaces.model.charts.bar.BarChartOptions; |
| 15 | import org.primefaces.model.charts.optionconfig.animation.Animation; |
14 | import org.primefaces.model.charts.optionconfig.animation.Animation; |
| 16 | import org.primefaces.model.charts.optionconfig.legend.Legend; |
15 | import org.primefaces.model.charts.optionconfig.legend.Legend; |
| 17 | import org.primefaces.model.charts.optionconfig.legend.LegendLabel; |
16 | import org.primefaces.model.charts.optionconfig.legend.LegendLabel; |
| 18 | import org.primefaces.model.charts.optionconfig.title.Title; |
17 | import org.primefaces.model.charts.optionconfig.title.Title; |
| - | 18 | import org.primefaces.model.charts.optionconfig.tooltip.Tooltip; |
|
| 19 | import org.springframework.beans.factory.annotation.Autowired; |
19 | import org.springframework.beans.factory.annotation.Autowired; |
| 20 | import org.springframework.stereotype.Service; |
20 | import org.springframework.stereotype.Service; |
| 21 | 21 | ||
| 22 | import br.com.ec.core.generic.AbstractService; |
22 | import br.com.ec.core.generic.AbstractService; |
| 23 | import br.com.ec.core.generic.GenericRepository; |
23 | import br.com.ec.core.generic.GenericRepository; |
| Line 79... | Line 79... | ||
| 79 | barDataSet.setBackgroundColor(cores); |
79 | barDataSet.setBackgroundColor(cores); |
| 80 | barDataSet.setBorderColor(bordas); |
80 | barDataSet.setBorderColor(bordas); |
| 81 | barDataSet.setBorderWidth(1); |
81 | barDataSet.setBorderWidth(1); |
| 82 | data.addChartDataSet(barDataSet); |
82 | data.addChartDataSet(barDataSet); |
| 83 | data.setLabels(marcadores); |
83 | data.setLabels(marcadores); |
| - | 84 | ||
| 84 | graficoBarra.setData(data); |
85 | graficoBarra.setData(data); |
| 85 | 86 | ||
| 86 | //Options
|
- | |
| 87 | BarChartOptions options = new BarChartOptions(); |
87 | BarChartOptions options = new BarChartOptions(); |
| 88 | CartesianScales cScales = new CartesianScales(); |
88 | CartesianScales cScales = new CartesianScales(); |
| 89 | CartesianLinearAxes linearAxes = new CartesianLinearAxes(); |
89 | CartesianLinearAxes linearAxes = new CartesianLinearAxes(); |
| 90 | linearAxes.setOffset(true); |
90 | linearAxes.setOffset(true); |
| 91 | CartesianLinearTicks ticks = new CartesianLinearTicks(); |
91 | CartesianLinearTicks ticks = new CartesianLinearTicks(); |
| 92 | ticks.setBeginAtZero(true); |
92 | ticks.setBeginAtZero(true); |
| 93 | linearAxes.setTicks(ticks); |
93 | linearAxes.setTicks(ticks); |
| 94 | cScales.setDisplay(true); |
94 | cScales.setDisplay(true); |
| 95 | cScales.addYAxesData(linearAxes); |
95 | cScales.addYAxesData(linearAxes); |
| 96 | options.setScales(cScales); |
96 | options.setScales(cScales); |
| 97 | - | ||
| - | 97 | ||
| 98 | Title title = new Title(); |
98 | Title title = new Title(); |
| 99 | title.setText("VENDAS"); |
99 | title.setText("VENDAS"); |
| 100 | options.setTitle(title); |
100 | options.setTitle(title); |
| 101 | 101 | ||
| 102 | Legend legend = new Legend(); |
102 | Legend legend = new Legend(); |
| 103 | legend.setDisplay(true); |
103 | legend.setDisplay(true); |
| 104 | legend.setPosition("top"); |
104 | legend.setPosition("top"); |
| - | 105 | ||
| 105 | LegendLabel legendLabels = new LegendLabel(); |
106 | LegendLabel legendLabels = new LegendLabel(); |
| 106 | legendLabels.setFontStyle("bold"); |
107 | legendLabels.setFontStyle("bold"); |
| 107 | legendLabels.setFontColor("#2980B9"); |
108 | legendLabels.setFontColor("#2980B9"); |
| 108 | legendLabels.setFontSize(24); |
109 | legendLabels.setFontSize(24); |
| 109 | legend.setLabels(legendLabels); |
110 | legend.setLabels(legendLabels); |
| - | 111 | legend.setPosition("ne");//extra |
|
| 110 | options.setLegend(legend); |
112 | options.setLegend(legend); |
| 111 | 113 | ||
| 112 | // disable animation
|
- | |
| 113 | Animation animation = new Animation(); |
- | |
| 114 | animation.setDuration(0); |
- | |
| 115 | options.setAnimation(animation); |
- | |
| - | 114 | // Animation animation = new Animation();
|
|
| - | 115 | // animation.setDuration(0);
|
|
| - | 116 | // options.setAnimation(animation);
|
|
| 116 | 117 | ||
| 117 | graficoBarra.setOptions(options); |
118 | graficoBarra.setOptions(options); |
| 118 | - | ||
| - | 119 | graficoBarra.setExtender("barra"); |
|
| 119 | graficoLinhaDTO.setGraficoBarra(graficoBarra); |
120 | graficoLinhaDTO.setGraficoBarra(graficoBarra); |
| 120 | return graficoLinhaDTO; |
121 | return graficoLinhaDTO; |
| 121 | }
|
122 | }
|
| 122 | 123 | ||
| 123 | }
|
124 | }
|