package uk.ac.leeds.ccg.cluster; import uk.ac.leeds.ccg.geotools.*; import uk.ac.leeds.ccg.widgets.*; import java.io.*; import java.awt.*; import java.awt.event.*; import java.util.*; import xygraph.*; /* * TimeSeriesViewer.java * Created on 01 February 2001, 00:55 */ /** The timeseries to be viewed * * @author alistaiw */ public class TimeSeriesViewer extends java.awt.Panel implements ActionListener,TimeParametersChangedListener{ private static final String Header = "$Header: /export/cvsroot/spinsrc/src/uk/ac/leeds/ccg/cluster/TimeSeriesViewer.java,v 1.9 2002/01/16 14:24:20 alistaiw Exp $"; public java.awt.MenuBar menuBar1; private java.awt.Menu menu1, menu2; private java.awt.MenuItem menuItem2, menuItem4; //private uk.ac.leeds.ccg.geotools.Viewer viewer1; Database dbase = new Database(); Frame f; XYGraph graph = new XYGraph(); TimeParameters parameters; double mintime, maxtime; int numbin; public TimeSeriesViewer(Frame f,TimeParameters p) { this.f=f; f.setSize(400,400); setSize(400,400); f.setVisible(true); initComponents(); parameters = p; parameters.addTimeParametersChangedListener(this); mintime = parameters.getStartTime(); maxtime = parameters.getEndTime(); numbin = parameters.getNumBin(); } private void initComponents() { menuBar1 = new java.awt.MenuBar(); menu1 = new java.awt.Menu(); menuItem2 = new java.awt.MenuItem(); menuItem2.addActionListener(this); //viewer1 = new uk.ac.leeds.ccg.geotools.Viewer(); graph.setSize(400,400); // viewer1.setSize(250,250); graph.setBackground(Color.white); menu1.setLabel("File"); menuItem2.setName("Close"); menuItem2.setLabel("Quit"); menu1.add(menuItem2); menuBar1.add(menu1); setLayout(new java.awt.BorderLayout()); add(graph, java.awt.BorderLayout.CENTER); } /** handles the actions of the menubar - feel free to use a different one if you prefer * @param p1 the event */ public void actionPerformed(java.awt.event.ActionEvent p1) { String cmd = p1.getActionCommand(); // if its quit then quit! if(cmd.equalsIgnoreCase("quit")){ f.dispose(); } if(cmd.equalsIgnoreCase("exit")){ System.exit(0); } } /** allows the frame using the viewer to have the menu bar * @return the menubar */ public MenuBar getMenuBar(){ return menuBar1; } public void displayData2(){ EqualInterval2 equalinterval2; double bin[] = new double[400]; double bL, bU, to, from; String label; double tick; int itick; mintime = parameters.getStartTime(); maxtime = parameters.getEndTime(); numbin = parameters.getNumBin(); // System.out.println("Here - " + numbin +" "+ mintime +" "+ maxtime); graph.dataset.pointSet.removeAllElements(); f.setSize(400,400); GeoData gcases = dbase.getCaseVals(); Vector points = dbase.getPoints(); equalinterval2 = new EqualInterval2(gcases, numbin, mintime, maxtime); for (int j=0; j bU || to < bL) continue; if (to == from){ bin[j]++; continue; } double length = to - from; if (from maxtime) continue; // bin[ equalinterval2.classify((double) gcases.getValue(i)) ]++ ; // } for (int i=0; i