From: Arne V. <cob...@us...> - 2004-05-31 17:13:30
|
Update of /cvsroot/jrobin/src/org/jrobin/graph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12212/org/jrobin/graph Modified Files: FetchSource.java Grapher.java RrdGraphDef.java Log Message: JRobin 1.4.0 - Added setResolution() option - Added setLowerLimit() option Index: Grapher.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Grapher.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Grapher.java 30 May 2004 19:49:56 -0000 1.11 --- Grapher.java 31 May 2004 17:13:21 -0000 1.12 *************** *** 363,367 **** // Fetch all required datasources ! ve = src.fetch( rrd, startTime, endTime ); varList = ve.getNames(); --- 363,367 ---- // Fetch all required datasources ! ve = src.fetch( rrd, startTime, endTime, graphDef.getResolution() ); varList = ve.getNames(); *************** *** 587,596 **** double val; double[] tmpSeries = new double[numPoints]; ! GridRange range = graphDef.getGridRange(); ! boolean rigid = ( range != null ? range.isRigid() : false ); ! double lowerValue = ( range != null ? range.getLowerValue() : Double.MAX_VALUE ); ! double upperValue = ( range != null ? range.getUpperValue() : Double.MIN_VALUE ); ! // For autoscale, detect lower and upper limit of values PlotDef[] plotDefs = graphDef.getPlotDefs(); --- 587,606 ---- double val; double[] tmpSeries = new double[numPoints]; ! ! boolean rigid = false; ! double lowerValue = Double.MAX_VALUE; ! double upperValue = Double.MIN_VALUE; ! GridRange range = graphDef.getGridRange(); ! if ( range != null ) ! { ! rigid = range.isRigid(); ! lowerValue = range.getLowerValue(); ! upperValue = range.getUpperValue(); ! ! if ( Double.isNaN(lowerValue) ) lowerValue = Double.MAX_VALUE; ! if ( Double.isNaN(upperValue) ) upperValue = Double.MIN_VALUE; ! } ! // For autoscale, detect lower and upper limit of values PlotDef[] plotDefs = graphDef.getPlotDefs(); Index: FetchSource.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/FetchSource.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FetchSource.java 30 May 2004 19:49:56 -0000 1.4 --- FetchSource.java 31 May 2004 17:13:21 -0000 1.5 *************** *** 147,155 **** * @param startTime Start time of the given timespan. * @param endTime End time of the given timespan. * @return A <code>ValueExtractor</code> object holding all fetched data. * @throws IOException Thrown in case of fetching I/O error. * @throws RrdException Thrown in case of a JRobin specific error. */ ! protected ValueExtractor fetch ( RrdDb rrd, long startTime, long endTime ) throws IOException, RrdException { int dsSize = 0; --- 147,156 ---- * @param startTime Start time of the given timespan. * @param endTime End time of the given timespan. + * @param resolution Resolution for the fetch request. * @return A <code>ValueExtractor</code> object holding all fetched data. * @throws IOException Thrown in case of fetching I/O error. * @throws RrdException Thrown in case of a JRobin specific error. */ ! protected ValueExtractor fetch ( RrdDb rrd, long startTime, long endTime, long resolution ) throws IOException, RrdException { int dsSize = 0; *************** *** 178,182 **** // Fetch datasources ! FetchRequest request = rrd.createFetchRequest( cfNames[i], startTime, endTime + rrdStep); request.setFilter( dsNames ); --- 179,183 ---- // Fetch datasources ! FetchRequest request = rrd.createFetchRequest( cfNames[i], startTime, endTime + rrdStep, resolution ); request.setFilter( dsNames ); Index: RrdGraphDef.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdGraphDef.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RrdGraphDef.java 31 May 2004 08:01:47 -0000 1.13 --- RrdGraphDef.java 31 May 2004 17:13:21 -0000 1.14 *************** *** 63,67 **** private long endTime = Util.getTime(); // default time span of the last 24 hours private long startTime = Util.getTime() - 86400L; ! private Title title = null; // no title private String valueAxisLabel = null; // no vertical label --- 63,68 ---- private long endTime = Util.getTime(); // default time span of the last 24 hours private long startTime = Util.getTime() - 86400L; ! private long resolution = 1; // resolution to fetch from the RRD databases ! private Title title = null; // no title private String valueAxisLabel = null; // no vertical label *************** *** 207,211 **** setTimePeriod( start.getTime(), end.getTime() ); } ! /** * Sets graph title. --- 208,222 ---- setTimePeriod( start.getTime(), end.getTime() ); } ! ! /** ! * Sets the resolution with which data will be fetched from the RRD sources. ! * JRobin will try to match the requested resolution as closely as possible. ! * @param resolution Resolution (data step) in seconds. ! */ ! public void setResolution( long resolution ) ! { ! this.resolution = resolution; ! } ! /** * Sets graph title. *************** *** 548,551 **** --- 559,564 ---- /** * Sets value range that will be presented in the graph. If not set, graph limits will be autoscaled. + * If you wish to specify one limit but leave the other auto-scaled, specify the value as Double.NaN + * fot the limit that should be auto-scaled. * @param lower Lower limit. * @param upper Upper limit. *************** *** 553,557 **** */ ! public void setGridRange(double lower, double upper, boolean rigid) { gridRange = new GridRange( lower, upper, rigid ); --- 566,570 ---- */ ! public void setGridRange( double lower, double upper, boolean rigid ) { gridRange = new GridRange( lower, upper, rigid ); *************** *** 559,562 **** --- 572,585 ---- /** + * This sets the lower limit of the grid to the specified value {@see setGridRange}. + * This is the equivalent of: <code>setGridRange( lower, Double.NaN, false );</code> + * @param lower Lower limit. + */ + public void setLowerLimit( double lower ) + { + gridRange = new GridRange( lower, Double.NaN, false ); + } + + /** * This sets the grid and labels on the Y axis. * Minor grid lines appear at <code>gridStep</code>, major grid lines accompanied by a label *************** *** 1139,1143 **** return endTime; } ! protected Title getTitle() { return title; --- 1162,1170 ---- return endTime; } ! ! protected long getResolution() { ! return resolution; ! } ! protected Title getTitle() { return title; |