public ValueGraphElement getElement ( int i ) { if ( ( i < 0 ) || ( i >= values . length ) ) { throw new NoSuchElementException ( ) ; } int minHeight = config . valueMinHeight ; // normalize height to value between 0 and 1: float value = ( ( float ) values [ i ] ) / ( ( float ) maxValue ) ; float usableHeight = height - minHeight ; int valueHeight = ( int ) ( usableHeight * value ) + minHeight ; int elX = Graph . xlateX ( width , values . length , i ) ; int elW = Graph . xlateX ( width , values . length , i + 1 ) - elX ; int elY = height - valueHeight ; boolean hot = i == highlightValue ; return new ValueGraphElement ( x + elX , y + elY , elW , valueHeight , hot , config ) ; }
return the i th ValueGraphElement