else if (types[xCol-1] == Test.TYPE_DATETIME)
} else if (types[xCol-1] == Test.TYPE_DATETIME) {
  public void displayResult(Statement s, int idx){    final int fin_idx=idx;    final int fin_runID=getRunID();    final Statement fin_s=s;	final Test fin_whichTest = getValidator().getTest(idx);    	    final SwingWorker worker = new SwingWorker(){		int idx=fin_idx;		int runID=fin_runID;		Statement s=fin_s;		Test whichTest = fin_whichTest;		String [] legends;		String [] stringLabels;		double [][] valueMatrix;        public Object construct() {		  try{			List legendList = new ArrayList ();			int numThirdDim = 1;			Graphable graphableTest = (Graphable) whichTest;			boolean hasThirdDim = graphableTest.hasThirdDimension();			boolean showMultiple = graphableTest.showMultipleGraphs();						if (!hasThirdDim) {			  legends = new String [1];			  String[] headers=whichTest.getHeaders();			  legends[0]=headers[graphableTest.getYAxisColumn ()-1];			  legendList.add (legends[0]);			}			List labels = new ArrayList ();			ResultSet rs=s.executeQuery("SELECT * FROM "+whichTest.getTableName(runID));			int zCol = graphableTest.getZAxisColumn ();						int rows=0;			Set uniqueLegendNames = new HashSet();			while (rs.next()) {			  if (hasThirdDim)				uniqueLegendNames.add(rs.getString(zCol));			  rows++;			}			if (debug)			  System.out.println ("displayResult.worker.construct - JDBC 1.0 - rows: "+rows);			if (rows == 0) // nothing to show			  return new MyChart();			if (hasThirdDim) {			  legendList.addAll (uniqueLegendNames);			  Collections.sort (legendList);			  legends = (String []) legendList.toArray (new String[] {});			  numThirdDim = legends.length;			}			  			// need to get a new copy of the result set			rs=s.executeQuery("SELECT * FROM "+whichTest.getTableName(runID));			valueMatrix = new double[numThirdDim][rows];			int numColumns = populateValues (rs, graphableTest, legendList, labels, valueMatrix);			if (numColumns == 0) 			  numColumns = 1;						rs.close();			// chop off parts of matrix that are not filled in			double [][] valueMatrix2  = new double[numThirdDim][numColumns];			for (int i = 0; i < numThirdDim; i++)			  for (int j = 0; j < numColumns; j++)				valueMatrix2[i][j] = valueMatrix[i][j];			valueMatrix = valueMatrix2;						if (debug)			  System.out.println ("displayResult.worker.construct - total rows: "+rows);			stringLabels = (String []) labels.toArray(new String []{});			if (debug) {			  System.out.println ("displayResult.worker.construct - legends :");			  for (int i = 0; i < legends.length; i++)				System.out.println (i + " " + legends[i]);			  System.out.println ("displayResult.worker.construct - labels :");			  for (int i = 0; i < stringLabels.length; i++)				System.out.println (i + " " + stringLabels[i]);			  System.out.println ("displayResult.worker.construct - values :");			  for (int i = 0; i < numThirdDim; i++) {				System.out.print ("[");								for (int j = 0; j < valueMatrix[i].length; j++)				  System.out.print ("" + valueMatrix[i][j] + ((j == valueMatrix[i].length-1) ? "" : ","));				System.out.println ("]");			  }			}		  } catch(SQLException e){			logger.logMessage(Logger.ERROR,Logger.DB_WRITE,							  "Could not produce HTML from validation table",e);		  }		  return ucChart;		}		protected int populateValues (ResultSet rs, Graphable graphableTest,									   List legendList, 									   List labels, double [][] valueMatrix) {		  boolean hasThirdDim = graphableTest.hasThirdDimension();		  int xCol = graphableTest.getXAxisColumn ();		  int yCol = graphableTest.getYAxisColumn ();		  int zCol = graphableTest.getZAxisColumn ();		  int types[]=((Test)graphableTest).getTypes();		  String lastX = "";		  int currentColumn=-1; // values for each z axis of data		  try {			while(rs.next()){			  // X axis labels			  String label = "?";			  if (types[xCol-1] == Test.TYPE_STRING)				label = rs.getString(xCol);			  else if (types[xCol-1] == Test.TYPE_DATETIME)				label = rs.getTimestamp(xCol).toString();			  if (!label.equals(lastX)) {				labels.add (label);				currentColumn++;			  } 			  lastX = label;			  			  // Z axis index			  int zAxisIndex = (hasThirdDim) ?				legendList.indexOf(rs.getString(zCol)) : 0;			  			  if (zAxisIndex == -1)				System.out.println ("GraphPane.construct - huh? " + 									"zAxisIndex is undefined. legend List " + legendList + 									" does not contain z col " + rs.getString(zCol));			  // Y axis values			  // if (debug)			  //System.out.println ("[" + zAxisIndex + "]["+currentColumn+"] = " + rs.getInt(yCol));			  			  valueMatrix[zAxisIndex][currentColumn] = getDoubleValue(rs, yCol);			}		  } catch(SQLException e){			logger.logMessage(Logger.ERROR,Logger.DB_WRITE,							  "Could not produce HTML from validation table",e);		  }		  return currentColumn;		}				public double getDoubleValue (ResultSet rs, int yCol) {		  double doubleValue;			  		  try {			//				intValue = rs.getInt(yCol);			doubleValue = rs.getDouble(yCol);		  } catch (SQLException e) {			try {			  String strDoubleValue = rs.getString (yCol);			  try {				doubleValue = Double.parseDouble (strDoubleValue);			  }			  catch (NumberFormatException nfe) {				doubleValue = 0;			  }			} catch (SQLException se) {			  doubleValue = 0;			}		  }		  return doubleValue;		}		        //Runs on the event-dispatching thread.        public void finished(){		  if (stringLabels == null) return;		  		  ucChart.setLegends(legends);		  ucChart.setLabels (stringLabels);		  if (legends.length > 1) {			if (debug)			  System.out.println ("GraphPane.finished - num legends " + legends.length);						Color [] colorTable = new Color [legends.length];						for (int i = 0; i < legends.length; i++)			  colorTable[i] = possibleColors[i%possibleColors.length];			ucChart.setColors(colorTable);		  }		  else 			ucChart.setColors(new Color [] {Color.blue});		  Rectangle bounds = ucChart.getBounds ();		  int height = getPixelHeight(ucChart.getFontMetrics(ucChart.getFont()),legends);		  		  ucChart.setBounds ((int)bounds.getX(), (int)bounds.getY(),		  					 getPixelWidth(ucChart.getFontMetrics(ucChart.getFont()),stringLabels,legends),		  					 height);		  ((MyChart)ucChart).setDim(new Dimension((int)ucChart.getBounds().getWidth(),												  height-10));		  ucChart.setMinimumSize(ucChart.getPreferredSize());		  ucChart.invalidate ();		  scrollPane.invalidate();		  scrollPane.repaint();					  if (debug)			System.out.println ("displayResult.worker.construct - bounds " + //before:\n"+bounds + 								" after\n" + ucChart.getBounds());					  ucChart.setValues (valueMatrix);		  //			ucChart.setChartType( UniversalChart.PLOT );		  ucChart.setChartType( UniversalChart.PARALLEL );		  if (!ucChart.isVisible())			ucChart.setVisible(true);		  setText("<HTML><CENTER><H1></H1></CENTER></HTML>");        }		protected int getPixelWidth (FontMetrics fontMetrics, String [] labels,									 String [] legends) {		  int width = 0;		  		  for (int i = 0; i < labels.length; i++)			width += fontMetrics.stringWidth(labels[i]);		  		  if (legends.length > 1)			width = Math.max (width, legends.length*15);		  		  return width;		}		protected int getPixelHeight (FontMetrics fontMetrics, String [] legends) {		  return legends.length*(fontMetrics.getHeight()+2);		}      };	worker.start();    }