KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > krysalis > jcharts > test > RadarTestDriver


1
2 package org.krysalis.jcharts.test;
3
4 import java.awt.Color JavaDoc;
5 import java.awt.Paint JavaDoc;
6
7 import org.krysalis.jcharts.chartData.ChartDataException;
8 import org.krysalis.jcharts.chartData.RadarChartDataSet;
9 import org.krysalis.jcharts.nonAxisChart.RadarChart;
10 import org.krysalis.jcharts.properties.ChartProperties;
11 import org.krysalis.jcharts.properties.LegendAreaProperties;
12 import org.krysalis.jcharts.properties.LegendProperties;
13 import org.krysalis.jcharts.properties.PropertyException;
14 import org.krysalis.jcharts.properties.RadarChartProperties;
15
16 /**
17  * Test driver for the radar chart class
18  *
19  * @author Rami Hansenne
20  */

21 class RadarTestDriver
22 {
23
24         /*****************************************************************************************
25          *
26          * @param args
27          * @throws PropertyException
28          * @throws ChartDataException
29          *****************************************************************************************/

30         public static void main( String JavaDoc[] args ) throws PropertyException, ChartDataException
31         {
32                 RadarChartProperties radarChartProperties = new RadarChartProperties();
33                 radarChartProperties.setFillRadar(true);
34                 radarChartProperties.setShowGridLines(true);
35                 radarChartProperties.setScaleMaxValue(1.0);
36                 radarChartProperties.setScaleIncrement(0.25);
37
38                 double[][] data = {{0.53, 0.31, 0.38, 0.21, 0.17, 0.63, 0.38}, {0.24, 0.43, 0.65, 0.60, 0.31, 0.45, 0.38} };
39                 Paint JavaDoc[] paints = {Color.red , Color.blue};
40                 String JavaDoc[] legendLabels = {"Test Legend Label", "other data"};
41                 String JavaDoc[] axisLabels = {"label1", "label2", "label3", "label4","label5","label16", "label7"};
42                 RadarChartDataSet dataSet = new RadarChartDataSet( "sample title", data, legendLabels, paints, axisLabels, radarChartProperties );
43
44                 ChartProperties chartProperties = new ChartProperties();
45
46                 LegendProperties legendProperties = new LegendProperties();
47                 legendProperties.setPlacement( LegendAreaProperties.RIGHT );
48                 legendProperties.setNumColumns( 1 );
49
50                 RadarChart chart = new RadarChart( dataSet, legendProperties, chartProperties , 500, 400 );
51
52                 ChartTestDriver.exportImage( chart, "RadarChartTest.png" );
53         }
54
55
56
57 }
58
Popular Tags