int iwidth = m_plotPanel.getWidth(); int iheight = m_plotPanel.getHeight();
int iwidth = m_osi.getWidth(this); int iheight = m_osi.getHeight(this);
  protected void updateChart(double [] dataPoint) {    int iwidth = m_plotPanel.getWidth();    int iheight = m_plotPanel.getHeight();    //    System.err.println(dataPoint[0]);    if (dataPoint.length-1 != m_previousY.length) {      m_previousY = new double [dataPoint.length-1];      //      m_plotCount = 0;      for (int i = 0; i < dataPoint.length-1; i++) {	m_previousY[i] = convertToPanelY(0);      }    }    Graphics osg = m_osi.getGraphics();        Graphics g = m_plotPanel.getGraphics();    // paint the old scale onto the plot if a scale update has occured    if (m_yScaleUpdate) {      String maxVal = numToString(m_oldMax);      String minVal = numToString(m_oldMin);      String midVal = numToString((m_oldMax - m_oldMin) / 2.0);      if (m_labelMetrics == null) {	m_labelMetrics = g.getFontMetrics(m_labelFont);      }      osg.setFont(m_labelFont);      int wmx = m_labelMetrics.stringWidth(maxVal);      int wmn = m_labelMetrics.stringWidth(minVal);      int wmd = m_labelMetrics.stringWidth(midVal);      int hf = m_labelMetrics.getAscent();      osg.setColor(m_colorList[m_colorList.length-1]);      osg.drawString(maxVal, iwidth-wmx, hf-2);      osg.drawString(midVal, iwidth-wmd, (iheight / 2)+(hf / 2));      osg.drawString(minVal, iwidth-wmn, iheight-1);      m_yScaleUpdate = false;      System.err.println("Here");    }    osg.copyArea(m_refreshWidth,0,iwidth-m_refreshWidth,		 iheight,-m_refreshWidth,0);    osg.setColor(Color.black);    osg.fillRect(iwidth-m_refreshWidth,0, iwidth, iheight);    double pos;    for (int i = 0; i < dataPoint.length-1; i++) {      osg.setColor(m_colorList[(i % m_colorList.length)]);      pos = convertToPanelY(dataPoint[i]);      osg.drawLine(iwidth-m_refreshWidth, (int)m_previousY[i], 		   iwidth-1, (int)pos);      m_previousY[i] = pos;      if (dataPoint[dataPoint.length-1] % m_xValFreq == 0) {	// draw the actual y value onto the plot for this curve	String val = numToString(dataPoint[i]);	if (m_labelMetrics == null) {	  m_labelMetrics = g.getFontMetrics(m_labelFont);	}	int hf = m_labelMetrics.getAscent();	if (pos - hf < 0) {	  pos += hf;	}	int w = m_labelMetrics.stringWidth(val);	osg.setFont(m_labelFont);	osg.drawString(val, iwidth-w, (int)pos);      }    }        // last element in the data point array contains the data point number    if (dataPoint[dataPoint.length-1] % m_xValFreq == 0) {      String xVal = ""+(int)dataPoint[dataPoint.length-1];      osg.setColor(m_colorList[m_colorList.length-1]);      int w = m_labelMetrics.stringWidth(xVal);      osg.setFont(m_labelFont);      osg.drawString(xVal, iwidth-w, iheight - 1);    }    g.drawImage(m_osi,0,0,m_plotPanel);    //    System.err.println("Finished");    //    m_plotCount++;  }