/**
* Main class, so you can have an example. You can put your own attribute names in parameter
*/
public static void main(String[] args) {
IFrame frame = new Frame();
String[] xAttributeNameList = null;
String[] yAttributeNameList = null;
if (args != null && args.length > 1) {
xAttributeNameList = new String[] { args[0] };
yAttributeNameList = new String[] { args[1] };
}
else {
xAttributeNameList = new String[] { "tango/tangotest/titan/float_spectrum_ro",
"tango/tangotest/titan/float_spectrum" };
yAttributeNameList = new String[] { "tango/tangotest/titan/float_spectrum_ro",
"tango/tangotest/titan/double_spectrum" };
}
DualNumberSpectrumViewer f = new DualNumberSpectrumViewer();
f.setXAttributeNameList(xAttributeNameList);
f.setYAttributeNameList(yAttributeNameList);
f.setColorArrayList(new Color[] { Color.BLUE, Color.RED });
f.setMarkerStyleList(new int[] { IChartViewer.MARKER_BOX });
f.setMarkerSizeList(new int[] { 5 });
f.setDataArrayLineWidth(new int[] { 2 });
f.setY1GridStyle(IChartViewer.STYLE_LONG_DASH);
f.setY1GridVisible(true);
f.initDAO();
f.addChartViewerListener(new IChartViewerListener() {
@Override
public void chartViewerChanged(ChartViewerEvent event) {
StringBuilder builder = new StringBuilder("chartViewerChanged:");
builder.append("\n\tPoint: ").append(Arrays.toString(event.getSelectedPoint()));
builder.append("\n\tIndex: ").append(event.getSelectedIndex());
builder.append("\n\tViewId: ").append(event.getViewId());
builder.append("\n\tReason: ").append(event.getReason());
System.out.println(builder.toString());
}
});
frame.setContentPane(f);
frame.setSize(640, 600);
frame.setTitle(f.getClass().getName());
frame.setDefaultCloseOperation(IFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}