int histClassCounts[][]  = (AttributeVisualizationPanel.this.getWidth()<(int)(as.totalCount*0.1)) ? new int[tempVal][m_data.attribute(classIndex).numValues()+1] : new int[(int)(as.totalCount*0.1)][m_data.attribute(classIndex).numValues()+1];
int histClassCounts[][]  = new int[intervals][m_data.attribute(classIndex).numValues()+1];
    public void run() {      synchronized (m_locker) {	if(m_data.attribute(classIndex).isNominal()) {	  int tempVal = AttributeVisualizationPanel.this.getWidth()-4;	  if (tempVal < 1) {	    tempVal = 1;	  }	  int histClassCounts[][]  = (AttributeVisualizationPanel.this.getWidth()<(int)(as.totalCount*0.1)) ?	    new int[tempVal][m_data.attribute(classIndex).numValues()+1] : 	    new int[(int)(as.totalCount*0.1)][m_data.attribute(classIndex).numValues()+1];	  double barRange   = (as.numericStats.max - as.numericStats.min)/(double)histClassCounts.length;	  double currentBar = as.numericStats.min; // + barRange;	  maxValue = 0;	  	  if(m_colorList.size()==0)	    m_colorList.addElement(Color.black);	  for(int i=m_colorList.size(); i<m_data.attribute(classIndex).numValues()+1; i++) {	    Color pc = m_defaultColors[(i-1) % 10];	    int ija =  (i-1) / 10;	    ija *= 2; 	    for (int j=0;j<ija;j++) {	      pc = pc.darker();     	    }	    m_colorList.addElement(pc);	  }	  	  for(int k=0; k<m_data.numInstances(); k++) {	    int t=0;	    try {	      if(!m_data.instance(k).isMissing(attribIndex)) {		t = (int) Math.ceil((float)((m_data.instance(k).value(attribIndex)-as.numericStats.min)/barRange));		if(t==0) {		  if(m_data.instance(k).isMissing(classIndex))		    histClassCounts[t][0]++;		  else		    histClassCounts[t][(int)m_data.instance(k).value(classIndex)+1]++;		  //if(histCounts[t]>maxValue)		  //  maxValue = histCounts[t];		}		else {		  if(m_data.instance(k).isMissing(classIndex))		    histClassCounts[t-1][0]++;		  else		    histClassCounts[t-1][(int)m_data.instance(k).value(classIndex)+1]++;		  //if(histCounts[t-1]>maxValue)		  //  maxValue = histCounts[t-1];		}	      }	    }	    catch(ArrayIndexOutOfBoundsException ae) { 	      System.out.println("t:"+(t)+				 " barRange:"+barRange+				 " histLength:"+histClassCounts.length+				 " value:"+m_data.instance(k).value(attribIndex)+				 " min:"+as.numericStats.min+				 " sumResult:"+(m_data.instance(k).value(attribIndex)-as.numericStats.min)+				 " divideResult:"+(float)((m_data.instance(k).value(attribIndex)-as.numericStats.min)/barRange)+				 " finalResult:"+				 Math.ceil((float)((m_data.instance(k).value(attribIndex)-as.numericStats.min)/barRange)) ); }	  }	  for(int i=0; i<histClassCounts.length; i++) {	    int sum=0;	    for(int j=0; j<histClassCounts[i].length; j++) 	      sum = sum+histClassCounts[i][j];	    if(maxValue<sum)	      maxValue = sum;	  }	  histBarClassCounts = histClassCounts;	  m_barRange =  barRange;	  	}	else { //else if the class attribute is numeric	  int tempVal = AttributeVisualizationPanel.this.getWidth()-4;	  if (tempVal < 1) {	    tempVal = 1;	  }	  int histCounts[]  = (AttributeVisualizationPanel.this.getWidth()<(int)(as.totalCount*0.1)) ?	    new int[tempVal] : new int[(int)(as.totalCount*0.1)];	  double barRange   = (as.numericStats.max - as.numericStats.min)/(double)histCounts.length;	  double currentBar = as.numericStats.min; // + barRange;	  maxValue = 0;	  	  for(int k=0; k<m_data.numInstances(); k++) {	    int t=0;	    try {	      t = (int) Math.ceil((float)((m_data.instance(k).value(attribIndex)-as.numericStats.min)/barRange));	      if(t==0) {		histCounts[t]++;		if(histCounts[t]>maxValue)		  maxValue = histCounts[t];	      }	      else {		histCounts[t-1]++;		if(histCounts[t-1]>maxValue)		  maxValue = histCounts[t-1];	      }	    }	    catch(ArrayIndexOutOfBoundsException ae) { 	      ae.printStackTrace();	      System.out.println("t:"+(t)+				 " barRange:"+barRange+				 " histLength:"+histCounts.length+				 " value:"+m_data.instance(k).value(attribIndex)+				 " min:"+as.numericStats.min+				 " sumResult:"+(m_data.instance(k).value(attribIndex)-as.numericStats.min)+				 " divideResult:"+(float)((m_data.instance(k).value(attribIndex)-as.numericStats.min)/barRange)+				 " finalResult:"+				 Math.ceil((float)((m_data.instance(k).value(attribIndex)-as.numericStats.min)/barRange)) ); }	  }	  histBarCounts = histCounts;	  m_barRange =  barRange;	}		threadRun=false;	//Image tmpImg = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);	//drawGraph( tmpImg.getGraphics() );	//img = tmpImg;	AttributeVisualizationPanel.this.repaint();      }    }