// ChangeAngle:
// To change the starting angle of the first axis line in a
// chart, get the RadarChart's graph model and call the
// model's setStartAngle() method
import com.sas.graphics.components.radarchart.RadarChart;
import com.sas.graphics.components.radarchart.RadarChartModel;
import com.sas.graphics.components.radarchart.RadarChartTableDataModel;
import com.sas.graphics.components.AnalysisVariable;
import com.sas.graphics.components.ClassificationVariable;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
public class ChangeAngle extends JPanel {
private ChangeAngle theApp;
public ChangeAngle () {
setLayout(new BorderLayout());
// Create a data model and attach the data (defined below)
RadarChartTableDataModel dataModel=null;
dataModel=new RadarChartTableDataModel(new SampleData());
// Create a radar chart and get its graph model
RadarChart radarChart=new RadarChart(dataModel);
RadarChartModel graphModel=radarChart.getGraphModel();
// Set the start angle
graphModel.setStartAngle(20);
// Assign the Category and Response variable roles
dataModel.setCategoryVariable(
new ClassificationVariable("Cause"));
dataModel.setResponseVariable(
new AnalysisVariable("Count"));
// Set a graph title
radarChart.getTitle1().setText("Causes of Failure");
add(radarChart, BorderLayout.CENTER);
}
// Create the data source
static private class SampleData extends DefaultTableModel {
private static Class columnClass[]={String.class, String.class,
String.class, Double.class};
private static String columnNames[]={"Process","Day","Cause","Count"};
public SampleData() {
super();
Object data[][] = {
{"Process A", "March 1", "Contamination", new Double(15)},
{"Process A", "March 1", "Corrosion", new Double(2) },
{"Process A", "March 1", "Doping", new Double(1) },
{"Process A", "March 1", "Metallization", new Double(2) },
{"Process A", "March 1", "Miscellaneous", new Double(3) },
{"Process A", "March 1", "Oxide Defect", new Double(8) },
{"Process A", "March 1", "Silicon Defect", new Double(1) },
{"Process A", "March 2", "Contamination", new Double(16)},
{"Process A", "March 2", "Corrosion", new Double(3) },
{"Process A", "March 2", "Doping", new Double(1) },
{"Process A", "March 2", "Metallization", new Double(3) },
{"Process A", "March 2", "Miscellaneous", new Double(1) },
{"Process A", "March 2", "Oxide Defect", new Double(9) },
{"Process A", "March 2", "Silicon Defect", new Double(2) },
{"Process A", "March 3", "Contamination", new Double(20)},
{"Process A", "March 3", "Corrosion", new Double(1) },
{"Process A", "March 3", "Doping", new Double(1) },
{"Process A", "March 3", "Metallization", new Double(0) },
{"Process A", "March 3", "Miscellaneous", new Double(3) },
{"Process A", "March 3", "Oxide Defect", new Double(7) },
{"Process A", "March 3", "Silicon Defect", new Double(2) },
{"Process A", "March 4", "Contamination", new Double(12)},
{"Process A", "March 4", "Corrosion", new Double(1) },
{"Process A", "March 4", "Doping", new Double(1) },
{"Process A", "March 4", "Metallization", new Double(0) },
{"Process A", "March 4", "Miscellaneous", new Double(0) },
{"Process A", "March 4", "Oxide Defect", new Double(10)},
{"Process A", "March 4", "Silicon Defect", new Double(1) },
{"Process A", "March 5", "Contamination", new Double(23)},
{"Process A", "March 5", "Corrosion", new Double(1) },
{"Process A", "March 5", "Doping", new Double(1) },
{"Process A", "March 5", "Metallization", new Double(0) },
{"Process A", "March 5", "Miscellaneous", new Double(1) },
{"Process A", "March 5", "Oxide Defect", new Double(8) },
{"Process A", "March 5", "Silicon Defect", new Double(2) },
{"Process B", "March 1", "Contamination", new Double(8) },
{"Process B", "March 1", "Corrosion", new Double(2) },
{"Process B", "March 1", "Doping", new Double(1) },
{"Process B", "March 1", "Metallization", new Double(4) },
{"Process B", "March 1", "Miscellaneous", new Double(2) },
{"Process B", "March 1", "Oxide Defect", new Double(10)},
{"Process B", "March 1", "Silicon Defect", new Double(3) },
{"Process B", "March 2", "Contamination", new Double(9) },
{"Process B", "March 2", "Corrosion", new Double(0) },
{"Process B", "March 2", "Doping", new Double(1) },
{"Process B", "March 2", "Metallization", new Double(2) },
{"Process B", "March 2", "Miscellaneous", new Double(4) },
{"Process B", "March 2", "Oxide Defect", new Double(9) },
{"Process B", "March 2", "Silicon Defect", new Double(2) },
{"Process B", "March 3", "Contamination", new Double(4) },
{"Process B", "March 3", "Corrosion", new Double(1) },
{"Process B", "March 3", "Doping", new Double(1) },
{"Process B", "March 3", "Metallization", new Double(0) },
{"Process B", "March 3", "Miscellaneous", new Double(0) },
{"Process B", "March 3", "Oxide Defect", new Double(10)},
{"Process B", "March 3", "Silicon Defect", new Double(1) },
{"Process B", "March 4", "Contamination", new Double(2) },
{"Process B", "March 4", "Corrosion", new Double(2) },
{"Process B", "March 4", "Doping", new Double(1) },
{"Process B", "March 4", "Metallization", new Double(0) },
{"Process B", "March 4", "Miscellaneous", new Double(3) },
{"Process B", "March 4", "Oxide Defect", new Double(7) },
{"Process B", "March 4", "Silicon Defect", new Double(1) },
{"Process B", "March 5", "Contamination", new Double(1) },
{"Process B", "March 5", "Corrosion", new Double(3) },
{"Process B", "March 5", "Doping", new Double(1) },
{"Process B", "March 5", "Metallization", new Double(0) },
{"Process B", "March 5", "Miscellaneous", new Double(1) },
{"Process B", "March 5", "Oxide Defect", new Double(8) },
{"Process B", "March 5", "Silicon Defect", new Double(2) }
};
setDataVector(data, columnNames);
}
public Class getColumnClass(int column) {
return columnClass[column];
}
}
public static void main(String[] args) {
JFrame frame = new JFrame("BIP Graph Sample");
Container container = frame.getContentPane();
container.setLayout(new BorderLayout());
container.setBackground(Color.white);
JPanel bipPanel = new JPanel();
bipPanel.setLayout(new BorderLayout());
ChangeAngle bipGraphSample = new ChangeAngle ();
bipPanel.add(bipGraphSample, BorderLayout.CENTER);
container.add(bipPanel, BorderLayout.CENTER);
frame.setSize(600,450);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
} );
frame.setVisible(true);
}
}