/** * Default constructor * @param width Width in pixels * @param height Height in pixels * @param timeLength The number of time points to show * @param dataWidth Length of each data line */ public ChronologicalScrollingBarVisualisation3D( final int width, final int height, final int timeLength, final int dataWidth ) { this.barVis = new BarVisualisation3D( width, height ); this.data = new double[timeLength][dataWidth]; this.expectedDataLength = dataWidth; }
/** * {@inheritDoc} * @see org.openimaj.vis.VisualisationImageProvider#getVisualisationImage() */ @Override public MBFImage getVisualisationImage() { return this.barVis.getVisualisationImage(); }
/** * Set the maximum data value * @param max The maximum */ public void setMaximum( final double max ) { this.barVis.setMaximum( max ); }
/** * @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} }); } }
/** * Set the x axis name * @param xAxis The x axis */ public void setXAxisName( final String xAxis ) { this.barVis.setxAxisName( xAxis ); }
/** * {@inheritDoc} * @see org.openimaj.vis.VisualisationImageProvider#updateVis() */ @Override public void updateVis() { this.barVis.updateVis(); }
/** * Set the y axis name * @param yAxis The y axis */ public void setYAxisName( final String yAxis ) { this.barVis.setyAxisName( yAxis ); }
/** * {@inheritDoc} * @see org.openimaj.vis.VisualisationImageProvider#setRequiredSize(java.awt.Dimension) */ @Override public void setRequiredSize( final Dimension d ) { this.barVis.setRequiredSize( d ); }
/** * Set the z axis name * @param zAxis The z axis */ public void setZAxisName( final String zAxis ) { this.barVis.setzAxisName( zAxis ); }
/** * 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 ); }