leif 2004/01/29 22:39:35
Modified: instrument-manager/src/java/org/apache/excalibur/instrument/manager/http
SampleChartHandler.java LineChart.java
Log:
Display the year for sample intervals over 24 hours.
Revision Changes Path
1.3 +20 -13
avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/http/SampleChartHandler.java
Index: SampleChartHandler.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/http/SampleChartHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SampleChartHandler.java 8 Jan 2004 09:16:00 -0000 1.2
+++ SampleChartHandler.java 30 Jan 2004 06:39:35 -0000 1.3
@@ -155,43 +155,50 @@
{
// Once per 10 seconds.
hInterval = (int)( 10000 / interval );
- format = "{2}:{3}:{4}";
- detailFormat = "{0}/{1} {2}:{3}:{4}.{5}";
+ format = "{3}:{4}:{5}";
+ detailFormat = "{1}/{2} {3}:{4}:{5}.{6}";
}
else if( interval < 60000 )
{
// Once per minute.
hInterval = (int)( 60000 / interval );
- format = "{2}:{3}:{4}";
- detailFormat = "{0}/{1} {2}:{3}:{4}";
+ format = "{3}:{4}:{5}";
+ detailFormat = "{1}/{2} {3}:{4}:{5}";
}
else if( interval < 600000 )
{
// Once per 10 minutes
hInterval = (int)( 600000 / interval );
- format = "{0}/{1} {2}:{3}";
- detailFormat = "{0}/{1} {2}:{3}";
+ format = "{1}/{2} {3}:{4}";
+ detailFormat = "{1}/{2} {3}:{4}";
}
else if( interval < 3600000 )
{
// Once per hour.
hInterval = (int)( 3600000 / interval );
- format = "{0}/{1} {2}:{3}";
- detailFormat = "{0}/{1} {2}:{3}";
+ format = "{1}/{2} {3}:{4}";
+ detailFormat = "{1}/{2} {3}:{4}";
}
else if( interval < 86400000 )
{
// Once per day.
hInterval = (int)( 86400000 / interval );
- format = "{0}/{1}";
- detailFormat = "{0}/{1} {2}:{3}";
+ format = "{1}/{2}";
+ detailFormat = "{1}/{2} {3}:{4}";
+ }
+ else if( interval < 604800000 )
+ {
+ // Once per week.
+ hInterval = (int)( 604800000 / interval );
+ format = "{0}/{1}/{2}";
+ detailFormat = "{0}/{1}/{2}";
}
else
{
// Default to every 10 points.
hInterval = 10;
- format = "{0}/{1} {2}:{3}";
- detailFormat = "{0}/{1} {2}:{3}";
+ format = "{0}/{1}/{2}";
+ detailFormat = "{0}/{1}/{2}";
}
// Actually create the chart and add it to the content pane
1.2 +14 -10
avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/http/LineChart.java
Index: LineChart.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/instrument-manager/src/java/org/apache/excalibur/instrument/manager/http/LineChart.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LineChart.java 9 Nov 2003 16:36:33 -0000 1.1
+++ LineChart.java 30 Jan 2004 06:39:35 -0000 1.2
@@ -139,15 +139,15 @@
* @param sampleInterval The number of milliseconds represented by each data
sample.
* @param format Format of the text which is displayed along the x (time) axis
of
* the chart. The text will display the time of the line chart at a particular
- * interval. The text should take the format "{0}/{1} {2}:{3}:{4}.{5}" where
{0} is
- * replaced by the month, {1} by the day, {2} by the hour, {3} by the minute,
{4}
- * by the second, and {5} by the hundereths of a second.
+ * interval. The text should take the format "{0}/{1}/{2} {3}:{4}:{5}.{6}"
where
+ * {0} is replaced by the year, {1} by the month, {2} by the day, {3} by the
hour,
+ * {4} by the minute, {5} by the second, and {6} by the hundereths of a second.
* @param detailFormat Format of the text which is displayed over the component
as
* the user moves the mouse over the line chart. The text will display the
exact
* value of the line chart at a particular point. The text should take the
format
- * "{0}/{1} {2}:{3}:{4}.{5}" where {0} is replaced by the month, {1} by the
day,
- * {2} by the hour, {3} by the minute, {4} by the second, and {5} by the
hundereths
- * of a second.
+ * "{0}/{1}/{2} {3}:{4}:{5}.{6}" where {0} is replaced by the year, {1} by the
+ * month, {2} by the day, {3} by the hour, {4} by the minute, {5} by the
second,
+ * and {6} by the hundereths of a second.
* @param averageWindow Number of data points to do a moving average over when
the
* mouse is pressed on the component.
*/
@@ -245,8 +245,12 @@
calendar.setTime( dTime );
int v;
- String month, day, hour, minute, second, hundreths;
+ String year, month, day, hour, minute, second, hundreths;
+ // Substitute the year
+ v = calendar.get( Calendar.YEAR );
+ year = Integer.toString( v );
+
// Substitute the month
v = calendar.get( Calendar.MONTH ) - Calendar.JANUARY + 1;
if( v < 10 )
@@ -317,12 +321,12 @@
if( detailed )
{
format = MessageFormat.format( m_dFormat,
- new Object[]{month, day, hour, minute, second, hundreths} );
+ new Object[]{year, month, day, hour, minute, second, hundreths} );
}
else
{
format = MessageFormat.format( m_format,
- new Object[]{month, day, hour, minute, second, hundreths} );
+ new Object[]{year, month, day, hour, minute, second, hundreths} );
}
return format;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]