01: package org.krysalis.jcharts.test;
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.RadarChartDataSet;
08: import org.krysalis.jcharts.nonAxisChart.RadarChart;
09: import org.krysalis.jcharts.properties.ChartProperties;
10: import org.krysalis.jcharts.properties.LegendAreaProperties;
11: import org.krysalis.jcharts.properties.LegendProperties;
12: import org.krysalis.jcharts.properties.PropertyException;
13: import org.krysalis.jcharts.properties.RadarChartProperties;
14:
15: /**
16: * Test driver for the radar chart class
17: *
18: * @author Rami Hansenne
19: */
20: class RadarTestDriver {
21:
22: /*****************************************************************************************
23: *
24: * @param args
25: * @throws PropertyException
26: * @throws ChartDataException
27: *****************************************************************************************/
28: public static void main(String[] args) throws PropertyException,
29: ChartDataException {
30: RadarChartProperties radarChartProperties = new RadarChartProperties();
31: radarChartProperties.setFillRadar(true);
32: radarChartProperties.setShowGridLines(true);
33: radarChartProperties.setScaleMaxValue(1.0);
34: radarChartProperties.setScaleIncrement(0.25);
35:
36: double[][] data = {
37: { 0.53, 0.31, 0.38, 0.21, 0.17, 0.63, 0.38 },
38: { 0.24, 0.43, 0.65, 0.60, 0.31, 0.45, 0.38 } };
39: Paint[] paints = { Color.red, Color.blue };
40: String[] legendLabels = { "Test Legend Label", "other data" };
41: String[] axisLabels = { "label1", "label2", "label3", "label4",
42: "label5", "label16", "label7" };
43: RadarChartDataSet dataSet = new RadarChartDataSet(
44: "sample title", data, legendLabels, paints, axisLabels,
45: radarChartProperties);
46:
47: ChartProperties chartProperties = new ChartProperties();
48:
49: LegendProperties legendProperties = new LegendProperties();
50: legendProperties.setPlacement(LegendAreaProperties.RIGHT);
51: legendProperties.setNumColumns(1);
52:
53: RadarChart chart = new RadarChart(dataSet, legendProperties,
54: chartProperties, 500, 400);
55:
56: ChartTestDriver.exportImage(chart, "RadarChartTest.png");
57: }
58:
59: }
|