private void init ( ) { width = Double . MAX_VALUE ; for ( int i = 1 ; i < data . length ; i ++ ) { double w = Math . abs ( data [ i ] [ 0 ] - data [ i - 1 ] [ 0 ] ) ; if ( width > w ) { width = w ; } } leftTop = new double [ data . length ] [ 2 ] ; rightTop = new double [ data . length ] [ 2 ] ; leftBottom = new double [ data . length ] [ 2 ] ; rightBottom = new double [ data . length ] [ 2 ] ; for ( int i = 0 ; i < data . length ; i ++ ) { leftTop [ i ] [ 0 ] = data [ i ] [ 0 ] - width / 2 ; leftTop [ i ] [ 1 ] = data [ i ] [ 1 ] ; rightTop [ i ] [ 0 ] = data [ i ] [ 0 ] + width / 2 ; rightTop [ i ] [ 1 ] = data [ i ] [ 1 ] ; leftBottom [ i ] [ 0 ] = data [ i ] [ 0 ] - width / 2 ; leftBottom [ i ] [ 1 ] = 0 ; rightBottom [ i ] [ 0 ] = data [ i ] [ 0 ] + width / 2 ; rightBottom [ i ] [ 1 ] = 0 ; } }
Calculate bar width and position .