@ -93,13 +93,16 @@ public class NetworkHistory {
}
// find correct scale
int maxpeers = 10 ; // to be measured by pre-scanning the db
int maxpeers = 10 0, minpeers = Integer . MAX_VALUE ; // to be measured by pre-scanning the db
for ( Map < String , Long > row : rows ) {
for ( String column : columns ) {
Long v = row . get ( column ) ;
if ( v ! = null ) maxpeers = Math . max ( maxpeers , ( int ) v . longValue ( ) ) ;
if ( v ! = null & & v . longValue ( ) > 0 ) minpeers = Math . min ( minpeers , ( int ) v . longValue ( ) ) ;
}
}
maxpeers = 10 * ( ( maxpeers / 9 * 10 ) / 10 ) ;
minpeers = 10 * ( ( minpeers * 9 / 10 ) / 10 ) ;
final int leftborder = 30 ;
final int rightborder = 10 ;
final int width = post . getInt ( "width" , 768 + leftborder + rightborder ) ;
@ -108,7 +111,7 @@ public class NetworkHistory {
final int topborder = 20 ;
final int bottomborder = 20 ;
final int vspace = height - topborder - bottomborder ;
final int leftscale = maxpeers / 10 ;
final int leftscale = 10 * ( maxpeers / 10 0) ;
String timestr = maxtime + " HOURS" ;
if ( maxtime > 24 & & maxtime % 24 = = 0 ) timestr = ( maxtime / 24 ) + " DAYS" ;
if ( maxtime = = 168 ) timestr = "WEEK" ;
@ -121,11 +124,11 @@ public class NetworkHistory {
if ( columns . contains ( "cC" ) ) headline + = ", ACTIVE SENIOR PEERS" ;
if ( columns . contains ( "cD" ) ) headline + = ", PASSIVE SENIOR PEERS" ;
if ( columns . contains ( "cP" ) ) headline + = ", POTENTIAL JUNIOR PEERS" ;
if ( columns . contains ( "cI" ) ) headline = "YACY INDEX SIZE HISTORY: NUMBER OF DOCUMENTS";
if ( columns . contains ( "cR" ) ) headline = "YACY INDEX SIZE HISTORY: NUMBER OF RWI ENTRIES";
if ( columns . contains ( "cI" ) ) headline = "YACY PEER '" + sb . peers . myName ( ) + "' INDEX SIZE HISTORY: NUMBER OF DOCUMENTS";
if ( columns . contains ( "cR" ) ) headline = "YACY PEER '" + sb . peers . myName ( ) + "' INDEX SIZE HISTORY: NUMBER OF RWI ENTRIES";
ChartPlotter chart = new ChartPlotter ( width , height , 0xFFFFFFl , 0x000000l , 0xAAAAAAl , leftborder , rightborder , topborder , bottomborder , headline , "IN THE LAST " + timestr ) ;
chart . declareDimension ( ChartPlotter . DIMENSION_BOTTOM , bottomscale , hspace / ( maxtime / bottomscale ) , - maxtime , 0x000000l , 0xCCCCCCl , "TIME/HOURS" ) ;
chart . declareDimension ( ChartPlotter . DIMENSION_LEFT , leftscale , vspace * leftscale / maxpeers , 0 , 0x008800l , null , columns . contains ( "cI" ) ? "DOCUMENTS" : columns . contains ( "cR" ) ? "RWIs" : "PEERS" ) ;
chart . declareDimension ( ChartPlotter . DIMENSION_LEFT , leftscale , 10 * ( ( vspace * leftscale / ( maxpeers - minpeers ) ) / 10 ) , minpeers , 0x008800l , null , columns . contains ( "cI" ) ? "DOCUMENTS" : columns . contains ( "cR" ) ? "RWIs" : "PEERS" ) ;
// write the data
float x0 , x1 ;