/** * Data is copied into the visualisation, so the arrays passed in are untouched. * * {@inheritDoc} * @see org.openimaj.vis.Visualisation#setData(java.lang.Object) */ @Override public void setData( final double[] newData ) { if( newData.length != this.expectedDataLength ) throw new IllegalArgumentException( "WARNING: Data was not the correct length. Expected " +this.expectedDataLength+" got "+newData.length ); // Move all the old data up for( int i = 1; i < this.data.length; i++ ) System.arraycopy( this.data[i], 0, this.data[i-1], 0, this.expectedDataLength ); System.arraycopy( newData, 0, this.data[this.data.length-1], 0, this.expectedDataLength ); this.barVis.setData( this.data ); }
/** * @param args */ public static void main( final String[] args ) { final BarVisualisation3D bv = new BarVisualisation3D( 1000, 1000 ); bv.setData( new double[][] { { 6, 7, 8, 9, 10 }, { 5, 6, 7, 8, 9 }, { 4, 5, 6, 7, 8 }, { 3, 4, 5, 6, 7 }, { 2, 3, 4, 5, 6 }, { 1, 2, 3, 4, 5 }, { 0, 1, 2, 3, 4 }, {-1, 0, 1, 2, 3 }, {-2, -1, 0, 1, 2}, {-3, -2, -1, 0, 1}, {-4, -3, -2, -1, 0}, {-5, -4, -3, -2, -1} }); } }