01: package org.krysalis.jcharts.demo.samples;
02:
03: import java.awt.Color;
04: import java.awt.Paint;
05:
06: import org.krysalis.jcharts.chartData.ChartDataException;
07: import org.krysalis.jcharts.chartData.PieChartDataSet;
08: import org.krysalis.jcharts.nonAxisChart.PieChart3D;
09: import org.krysalis.jcharts.properties.ChartProperties;
10: import org.krysalis.jcharts.properties.LegendProperties;
11: import org.krysalis.jcharts.properties.PieChart3DProperties;
12: import org.krysalis.jcharts.properties.util.ChartStroke;
13: import org.krysalis.jcharts.types.PieLabelType;
14:
15: /*************************************************************************************
16: *
17: * @author Nathaniel Auvil
18: * @version $Id: Pie3DSamples.java,v 1.2 2003/09/02 08:48:19 nicolaken Exp $
19: ************************************************************************************/
20: public class Pie3DSamples extends Sample {
21:
22: protected String getSubdir() {
23: return "pie3d/";
24: }
25:
26: public void render() throws ChartDataException {
27: double[] data = { 45.00d, 90.00d, 45.00d, 180d };
28: String[] labels = { "Equities", "Bonds", "Money Market",
29: "Alternative Investments" };
30:
31: Paint[] paints = { new Color(200, 0, 0, 20),
32: new Color(0, 200, 0, 20), new Color(0, 0, 200, 20),
33: new Color(200, 200, 0, 20) };
34:
35: PieChart3DProperties pieChart3DProperties = new PieChart3DProperties();
36: pieChart3DProperties
37: .setPieLabelType(PieLabelType.LEGEND_LABELS);
38: pieChart3DProperties.setTickLength(5);
39:
40: pieChart3DProperties.setZeroDegreeOffset(60);
41:
42: pieChart3DProperties.setDepth(15);
43:
44: LegendProperties legendProperties = null;
45: /*
46: LegendProperties legendProperties = new LegendProperties();
47: legendProperties.setPlacement( LegendAreaProperties.RIGHT );
48: legendProperties.setNumColumns( 1 );
49: */
50:
51: PieChartDataSet pieChartDataSet = new PieChartDataSet(
52: "Investment Categories", data, labels, paints,
53: pieChart3DProperties);
54:
55: ChartProperties chartProperties = new ChartProperties();
56: chartProperties
57: .setBorderStroke(ChartStroke.DEFAULT_CHART_OUTLINE);
58:
59: PieChart3D pieChart = new PieChart3D(pieChartDataSet,
60: legendProperties, chartProperties, 500, 400);
61:
62: super .encode(pieChart, "pie3d");
63: }
64: }
|