From: Arne V. <cob...@us...> - 2005-01-23 20:31:36
|
Update of /cvsroot/jrobin/src/org/jrobin/graph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26216/org/jrobin/graph Modified Files: ChartGraphics.java CustomArea.java CustomLine.java ExportData.java FetchSource.java Grapher.java RrdExporter.java RrdGraphDef.java Source.java ValueGrid.java Log Message: JRobin 2.0 - Additions and related changes Index: CustomLine.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/CustomLine.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CustomLine.java 9 Jul 2004 12:22:15 -0000 1.4 --- CustomLine.java 23 Jan 2005 20:31:26 -0000 1.5 *************** *** 31,34 **** --- 31,35 ---- import org.jrobin.core.RrdException; import org.jrobin.core.XmlWriter; + import org.jrobin.core.Util; /** *************** *** 121,134 **** // Get X positions ! if ( xVal1 == Long.MIN_VALUE ) ax = g.getMinX(); ! else if ( xVal1 == Long.MAX_VALUE ) ax = g.getMaxX(); else ax = g.getX( xVal1 ); ! if ( xVal2 == Long.MIN_VALUE ) nx = g.getMinX(); ! else if ( xVal2 == Long.MAX_VALUE ) nx = g.getMaxX(); else --- 122,135 ---- // Get X positions ! if ( xVal1 == Util.MIN_LONG ) ax = g.getMinX(); ! else if ( xVal1 == Util.MAX_LONG ) ax = g.getMaxX(); else ax = g.getX( xVal1 ); ! if ( xVal2 == Util.MIN_LONG ) nx = g.getMinX(); ! else if ( xVal2 == Util.MAX_LONG ) nx = g.getMaxX(); else *************** *** 136,149 **** // Get Y positions ! if ( yVal1 == Double.MIN_VALUE ) ay = g.getMinY(); ! else if ( yVal1 == Double.MAX_VALUE ) ay = g.getMaxY(); else ay = g.getY( yVal1 ); ! if ( yVal2 == Double.MIN_VALUE ) ny = g.getMinY(); ! else if ( yVal2 == Double.MAX_VALUE ) ny = g.getMaxY(); else --- 137,150 ---- // Get Y positions ! if ( yVal1 == Util.MIN_DOUBLE ) ay = g.getMinY(); ! else if ( yVal1 == Util.MAX_DOUBLE ) ay = g.getMaxY(); else ay = g.getY( yVal1 ); ! if ( yVal2 == Util.MIN_DOUBLE ) ny = g.getMinY(); ! else if ( yVal2 == Util.MAX_DOUBLE ) ny = g.getMaxY(); else *************** *** 192,196 **** // Vrule ! if ( yVal1 == Double.MIN_VALUE && yVal2 == Double.MAX_VALUE ) return Double.NaN; --- 193,197 ---- // Vrule ! if ( yVal1 == Util.MIN_DOUBLE && yVal2 == Util.MAX_DOUBLE ) return Double.NaN; Index: Grapher.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Grapher.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Grapher.java 27 Jul 2004 12:30:17 -0000 1.20 --- Grapher.java 23 Jan 2005 20:31:26 -0000 1.21 *************** *** 38,41 **** --- 38,42 ---- import org.jrobin.core.RrdException; + import org.jrobin.core.Util; /** *************** *** 443,448 **** boolean rigid = false; ! double lowerValue = Double.MAX_VALUE; ! double upperValue = Double.MIN_VALUE; GridRange range = graphDef.getGridRange(); --- 444,449 ---- boolean rigid = false; ! double lowerValue = Util.MAX_DOUBLE; ! double upperValue = Util.MIN_DOUBLE; GridRange range = graphDef.getGridRange(); *************** *** 453,458 **** upperValue = range.getUpperValue(); ! if ( Double.isNaN(lowerValue) ) lowerValue = Double.MAX_VALUE; ! if ( Double.isNaN(upperValue) ) upperValue = Double.MIN_VALUE; } --- 454,459 ---- upperValue = range.getUpperValue(); ! if ( Double.isNaN(lowerValue) ) lowerValue = Util.MAX_DOUBLE; ! if ( Double.isNaN(upperValue) ) upperValue = Util.MIN_DOUBLE; } Index: ValueGrid.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ValueGrid.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ValueGrid.java 27 Oct 2004 20:36:26 -0000 1.14 --- ValueGrid.java 23 Jan 2005 20:31:26 -0000 1.15 *************** *** 26,29 **** --- 26,30 ---- import org.jrobin.core.RrdException; + import org.jrobin.core.Util; /** *************** *** 64,69 **** ValueGrid( GridRange gr, double low, double up, ValueAxisUnit vAxis, double base ) throws RrdException { ! double grLower = Double.MAX_VALUE; ! double grUpper = Double.MIN_VALUE; if ( gr != null ) --- 65,70 ---- ValueGrid( GridRange gr, double low, double up, ValueAxisUnit vAxis, double base ) throws RrdException { ! double grLower = Util.MAX_DOUBLE; ! double grUpper = Util.MIN_DOUBLE; if ( gr != null ) *************** *** 133,139 **** return; ! if ( Double.isNaN(upper) || upper == Double.MIN_VALUE || upper == Double.MAX_VALUE ) upper = 0.9; ! if ( Double.isNaN(lower) || lower == Double.MAX_VALUE || lower == Double.MIN_VALUE ) lower = 0; --- 134,140 ---- return; ! if ( Double.isNaN(upper) || upper == Util.MIN_DOUBLE || upper == Util.MAX_DOUBLE ) upper = 0.9; ! if ( Double.isNaN(lower) || lower == Util.MAX_DOUBLE || lower == Util.MIN_DOUBLE ) lower = 0; Index: ChartGraphics.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ChartGraphics.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ChartGraphics.java 9 Jul 2004 12:22:15 -0000 1.4 --- ChartGraphics.java 23 Jan 2005 20:31:26 -0000 1.5 *************** *** 91,95 **** void fillRect(int x1, int y1, int x2, int y2) { ! g.fillRect( x1, -y2, x2 - x1, - (y2 - y1) ); } --- 91,95 ---- void fillRect(int x1, int y1, int x2, int y2) { ! g.fillRect( x1, -y2, x2 - x1, (y2 - y1) ); } Index: RrdExporter.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdExporter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RrdExporter.java 28 Oct 2004 20:04:43 -0000 1.8 --- RrdExporter.java 23 Jan 2005 20:31:26 -0000 1.9 *************** *** 91,95 **** fetchSources.setRrdOpener( rrdOpener ); ! long finalEndTime = Long.MAX_VALUE; boolean changingEndTime = false; --- 91,95 ---- fetchSources.setRrdOpener( rrdOpener ); ! long finalEndTime = Util.MAX_LONG; boolean changingEndTime = false; Index: Source.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Source.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Source.java 28 Oct 2004 20:04:43 -0000 1.14 --- Source.java 23 Jan 2005 20:31:26 -0000 1.15 *************** *** 246,250 **** time = endTime; ! if ( lastTime > 0 && !Double.isNaN(value) && value != Double.MIN_VALUE && value != Double.MAX_VALUE ) { min = Util.min( min, value ); --- 246,250 ---- time = endTime; ! if ( lastTime > 0 && !Double.isNaN(value) && value != Util.MIN_DOUBLE && value != Util.MAX_DOUBLE ) { min = Util.min( min, value ); Index: CustomArea.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/CustomArea.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CustomArea.java 27 Oct 2004 20:36:26 -0000 1.6 --- CustomArea.java 23 Jan 2005 20:31:26 -0000 1.7 *************** *** 96,109 **** // Get X positions ! if ( xVal1 == Long.MIN_VALUE ) ax = g.getMinX(); ! else if ( xVal1 == Long.MAX_VALUE ) ax = g.getMaxX(); else ax = g.getX( xVal1 ); ! if ( xVal2 == Long.MIN_VALUE ) nx = g.getMinX(); ! else if ( xVal2 == Long.MAX_VALUE ) nx = g.getMaxX(); else --- 96,109 ---- // Get X positions ! if ( xVal1 == Util.MIN_LONG ) ax = g.getMinX(); ! else if ( xVal1 == Util.MAX_LONG ) ax = g.getMaxX(); else ax = g.getX( xVal1 ); ! if ( xVal2 == Util.MIN_LONG ) nx = g.getMinX(); ! else if ( xVal2 == Util.MAX_LONG ) nx = g.getMaxX(); else *************** *** 137,140 **** --- 137,141 ---- // Always use the y value of the second specified point to stack on if ( yVal2 != Util.MAX_DOUBLE ) + { for (int i = 0; i < stackValues.length; i++) if ( xValues[i] < ax || xValues[i] > nx ) *************** *** 142,145 **** --- 143,147 ---- else stackValues[i] = g.getInverseY(ny); + } } *************** *** 147,151 **** * Retrieves the value for a specific point of the CustomArea. The CustomArea is always a rectangle, * this means the returned double value will always be equal to the (Y) value of the second datapoint. ! * In case of an unlimited CustomArea (second datapoint Y value is <code>Double.MAX_VALUE</code>) * the returned value is <code>Double.NaN</code>. * @param tblPos Table index of the datapoint to be retrieved. --- 149,153 ---- * Retrieves the value for a specific point of the CustomArea. The CustomArea is always a rectangle, * this means the returned double value will always be equal to the (Y) value of the second datapoint. ! * In case of an unlimited CustomArea (second datapoint Y value is <code>Util.MAX_DOUBLE</code>) * the returned value is <code>Double.NaN</code>. * @param tblPos Table index of the datapoint to be retrieved. *************** *** 168,177 **** // Stubbed method, irrelevant for this PlotDef ! void setSource( Source[] sources, HashMap sourceIndex ) throws RrdException { ! } // Stubbed, we don't need to set value for a Custom plotdef ! void setValue( int tableRow, long preciseTime, long[] reducedTimestamps ) { ! } void exportXmlTemplate( XmlWriter xml, String legend ) { --- 170,177 ---- // Stubbed method, irrelevant for this PlotDef ! void setSource( Source[] sources, HashMap sourceIndex ) throws RrdException {} // Stubbed, we don't need to set value for a Custom plotdef ! void setValue( int tableRow, long preciseTime, long[] reducedTimestamps ) {} void exportXmlTemplate( XmlWriter xml, String legend ) { Index: FetchSource.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/FetchSource.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FetchSource.java 21 Sep 2004 08:42:10 -0000 1.11 --- FetchSource.java 23 Jan 2005 20:31:26 -0000 1.12 *************** *** 298,302 **** openRrd(); ! long minSampleTime = Long.MAX_VALUE, sampleTime = 0; for ( int i = 0; i < datasources.length; i++ ) --- 298,302 ---- openRrd(); ! long minSampleTime = Util.MAX_LONG, sampleTime = 0; for ( int i = 0; i < datasources.length; i++ ) *************** *** 329,333 **** openRrd(); ! long maxStep = Long.MIN_VALUE, minStep = Long.MAX_VALUE, step = 0; for ( int i = 0; i < datasources.length; i++ ) --- 329,333 ---- openRrd(); ! long maxStep = Util.MIN_LONG, minStep = Util.MAX_LONG, step = 0; for ( int i = 0; i < datasources.length; i++ ) Index: RrdGraphDef.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdGraphDef.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** RrdGraphDef.java 21 Sep 2004 08:42:10 -0000 1.20 --- RrdGraphDef.java 23 Jan 2005 20:31:26 -0000 1.21 *************** *** 35,38 **** --- 35,39 ---- import org.jrobin.core.RrdException; import org.jrobin.core.XmlWriter; + import org.jrobin.core.Util; /** *************** *** 708,712 **** */ public void hrule(double value, Color color, String legend) throws RrdException { ! plotDefs.add( new CustomLine( Long.MIN_VALUE, value, Long.MAX_VALUE, value, color ) ); addLegend( legend, color ); } --- 709,713 ---- */ public void hrule(double value, Color color, String legend) throws RrdException { ! plotDefs.add( new CustomLine( Util.MIN_LONG, value, Util.MAX_LONG, value, color ) ); addLegend( legend, color ); } *************** *** 722,726 **** */ public void hrule(double value, Color color, String legend, int lineWidth) throws RrdException { ! plotDefs.add( new CustomLine( Long.MIN_VALUE, value, Long.MAX_VALUE, value, color, lineWidth ) ); addLegend( legend, color ); } --- 723,727 ---- */ public void hrule(double value, Color color, String legend, int lineWidth) throws RrdException { ! plotDefs.add( new CustomLine( Util.MIN_LONG, value, Util.MAX_LONG, value, color, lineWidth ) ); addLegend( legend, color ); } *************** *** 735,739 **** public void vrule( GregorianCalendar timestamp, Color color, String legend ) throws RrdException { long timeSecs = timestamp.getTimeInMillis() / 1000; ! plotDefs.add( new CustomLine( timeSecs, Double.MIN_VALUE, timeSecs, Double.MAX_VALUE, color ) ); addLegend( legend, color ); } --- 736,740 ---- public void vrule( GregorianCalendar timestamp, Color color, String legend ) throws RrdException { long timeSecs = timestamp.getTimeInMillis() / 1000; ! plotDefs.add( new CustomLine( timeSecs, Util.MIN_DOUBLE, timeSecs, Util.MAX_DOUBLE, color ) ); addLegend( legend, color ); } *************** *** 750,754 **** public void vrule( GregorianCalendar timestamp, Color color, String legend, int lineWidth ) throws RrdException { long timeSecs = timestamp.getTimeInMillis() / 1000; ! plotDefs.add( new CustomLine( timeSecs, Double.MIN_VALUE, timeSecs, Double.MAX_VALUE, color, lineWidth ) ); addLegend( legend, color ); } --- 751,755 ---- public void vrule( GregorianCalendar timestamp, Color color, String legend, int lineWidth ) throws RrdException { long timeSecs = timestamp.getTimeInMillis() / 1000; ! plotDefs.add( new CustomLine( timeSecs, Util.MIN_DOUBLE, timeSecs, Util.MAX_DOUBLE, color, lineWidth ) ); addLegend( legend, color ); } Index: ExportData.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ExportData.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ExportData.java 28 Oct 2004 20:04:43 -0000 1.7 --- ExportData.java 23 Jan 2005 20:31:26 -0000 1.8 *************** *** 176,182 **** /** ! * Returns the number of columns in this dataset. * ! * @return Number of columns (datasources). */ public int getColumnCount() { --- 176,182 ---- /** ! * Returns the number of cells in this dataset. * ! * @return Number of cells (datasources). */ public int getColumnCount() { *************** *** 522,526 **** xml.append( "\t\t<end>" + timestamps[arraySize - 1] + "</end>\n" ); xml.append( "\t\t<rows>" + arraySize + "</rows>\n" ); ! xml.append( "\t\t<columns>" + sources.length + "</columns>\n" ); xml.append( "\t\t<legend>\n" ); for ( int i = 0; i < sources.length; i++ ) --- 522,526 ---- xml.append( "\t\t<end>" + timestamps[arraySize - 1] + "</end>\n" ); xml.append( "\t\t<rows>" + arraySize + "</rows>\n" ); ! xml.append( "\t\t<cells>" + sources.length + "</cells>\n" ); xml.append( "\t\t<legend>\n" ); for ( int i = 0; i < sources.length; i++ ) *************** *** 582,586 **** // -- Parse the metadata ! int columns = Util.Xml.getChildValueAsInt( meta, "columns" ); long step = Util.Xml.getChildValueAsLong( meta, "step" ); String[] dsNames = new String[ columns ]; --- 582,586 ---- // -- Parse the metadata ! int columns = Util.Xml.getChildValueAsInt( meta, "cells" ); long step = Util.Xml.getChildValueAsLong( meta, "step" ); String[] dsNames = new String[ columns ]; |