1 package org.codehaus.mojo.dashboard.report.plugin.chart;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.awt.Font;
20
21 import org.jfree.chart.ChartFactory;
22 import org.jfree.chart.plot.PiePlot3D;
23 import org.jfree.data.general.PieDataset;
24 import org.jfree.util.Rotation;
25
26
27
28
29
30
31 public class PieChart3DRenderer extends AbstractChartRenderer
32 {
33
34 private static final double START_ANGLE = 45D;
35
36 private static final float FOREGROUND_ALPHA = 0.5f;
37
38
39
40
41 private static final int FONT_SIZE = 10;
42
43
44
45
46
47
48 public PieChart3DRenderer( IChartStrategy strategy )
49 {
50 super( strategy );
51 }
52
53
54
55
56
57
58
59
60 public PieChart3DRenderer( IChartStrategy strategy, int width, int height )
61 {
62 super( strategy, width, height );
63 }
64
65 public void createChart()
66 {
67 PieDataset dataset = (PieDataset) this.datasetStrategy.getDataset();
68 report = ChartFactory.createPieChart3D( this.datasetStrategy.getTitle(), dataset, false, true, true );
69
70 PiePlot3D plot3D = (PiePlot3D) report.getPlot();
71 plot3D.setDirection( Rotation.ANTICLOCKWISE );
72 plot3D.setStartAngle( PieChart3DRenderer.START_ANGLE );
73 plot3D.setForegroundAlpha( PieChart3DRenderer.FOREGROUND_ALPHA );
74 plot3D.setLabelFont( new Font("Lucida", 0, PieChart3DRenderer.FONT_SIZE ) );
75
76 }
77 }